org.springframework.integration.dsl.Pollers Java Examples

The following examples show how to use org.springframework.integration.dsl.Pollers. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FolderListener.java    From spring-batch-lightmin with Apache License 2.0 6 votes vote down vote up
private void initIntegrationFlow() {
    this.integrationFlow = IntegrationFlows
            .from(Files.inboundAdapter(new File(this.jobListenerConfiguration.getSourceFolder()))
                    .filter(this.fileFileListFilter)
                    .scanEachPoll(Boolean.TRUE)
                    .get(), e -> {
                e.poller(Pollers.fixedRate(this.jobListenerConfiguration.getPollerPeriod()).maxMessagesPerPoll(1000));
                e.autoStartup(Boolean.TRUE);
            })
            .transform(this.transformer,
                    e -> e.autoStartup(Boolean.TRUE))
            .handle(this.jobLaunchingMessageHandler)
            .channel(MessageChannels.direct())
            .handle(new JobExecutionFinishedMessageHandler())
            .get();

}
 
Example #2
Source File: TacoOrderEmailIntegrationConfig.java    From spring-in-action-5-samples with Apache License 2.0 5 votes vote down vote up
@Bean
public IntegrationFlow tacoOrderEmailFlow(
    EmailProperties emailProps,
    EmailToOrderTransformer emailToOrderTransformer,
    OrderSubmitMessageHandler orderSubmitHandler) {
  
  return IntegrationFlows
      .from(Mail.imapInboundAdapter(emailProps.getImapUrl()),
          e -> e.poller(
              Pollers.fixedDelay(emailProps.getPollRate())))
      .transform(emailToOrderTransformer)
      .handle(orderSubmitHandler)
      .get();
}
 
Example #3
Source File: TacoOrderEmailIntegrationConfig.java    From spring-in-action-5-samples with Apache License 2.0 5 votes vote down vote up
@Bean
public IntegrationFlow tacoOrderEmailFlow(
    EmailProperties emailProps,
    EmailToOrderTransformer emailToOrderTransformer,
    OrderSubmitMessageHandler orderSubmitHandler) {
  
  return IntegrationFlows
      .from(Mail.imapInboundAdapter(emailProps.getImapUrl()),
          e -> e.poller(
              Pollers.fixedDelay(emailProps.getPollRate())))
      .transform(emailToOrderTransformer)
      .handle(orderSubmitHandler)
      .get();
}
 
Example #4
Source File: TacoOrderEmailIntegrationConfig.java    From spring-in-action-5-samples with Apache License 2.0 5 votes vote down vote up
@Bean
public IntegrationFlow tacoOrderEmailFlow(
    EmailProperties emailProps,
    EmailToOrderTransformer emailToOrderTransformer,
    OrderSubmitMessageHandler orderSubmitHandler) {
  
  return IntegrationFlows
      .from(Mail.imapInboundAdapter(emailProps.getImapUrl()),
          e -> e.poller(
              Pollers.fixedDelay(emailProps.getPollRate())))
      .transform(emailToOrderTransformer)
      .handle(orderSubmitHandler)
      .get();
}
 
Example #5
Source File: JavaDSLFileCopyConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public IntegrationFlow fileMover() {
    return IntegrationFlows.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10000)))
        .filter(onlyJpgs())
        .handle(targetDirectory())
        .get();
}
 
Example #6
Source File: JavaDSLFileCopyConfig.java    From tutorials with MIT License 5 votes vote down vote up
public IntegrationFlow fileMoverWithLambda() {
    return IntegrationFlows.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10000)))
        .filter(message -> ((File) message).getName()
            .endsWith(".jpg"))
        .handle(targetDirectory())
        .get();
}
 
Example #7
Source File: TxIntegrationConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public PollerMetadata pollerMetadata() {
    return Pollers.fixedDelay(5000)
             .advice(transactionInterceptor())
             .transactionSynchronizationFactory(transactionSynchronizationFactory)
             .get();
}
 
Example #8
Source File: JavaDSLFileCopyConfig.java    From tutorials with MIT License 4 votes vote down vote up
public IntegrationFlow fileReader() {
    return IntegrationFlows.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10)))
        .filter(onlyJpgs())
        .channel("holdingTank")
        .get();
}
 
Example #9
Source File: JavaDSLFileCopyConfig.java    From tutorials with MIT License 4 votes vote down vote up
public IntegrationFlow fileWriter() {
    return IntegrationFlows.from("holdingTank")
        .bridge(e -> e.poller(Pollers.fixedRate(1, TimeUnit.SECONDS, 20)))
        .handle(targetDirectory())
        .get();
}
 
Example #10
Source File: JavaDSLFileCopyConfig.java    From tutorials with MIT License 4 votes vote down vote up
public IntegrationFlow anotherFileWriter() {
    return IntegrationFlows.from("holdingTank")
        .bridge(e -> e.poller(Pollers.fixedRate(2, TimeUnit.SECONDS, 10)))
        .handle(anotherTargetDirectory())
        .get();
}