/** * @param pollerMetadataSpec the pollerMetadataSpec * @return the endpoint spec. * @see org.springframework.integration.endpoint.AbstractPollingEndpoint * @see PollerSpec */ public S poller(PollerSpec pollerMetadataSpec) { Map<Object, String> components = pollerMetadataSpec.getComponentsToRegister(); if (components != null) { this.componentsToRegister.putAll(components); } return poller(pollerMetadataSpec.get()); }
/** * Specify a {@link TransactionInterceptor} {@link Advice} for the {@code pollingTask}. * @param transactionInterceptor the {@link TransactionInterceptor} to use. * @return the spec. * @see TransactionInterceptorBuilder */ public PollerSpec transactional(TransactionInterceptor transactionInterceptor) { return advice(transactionInterceptor); }
public static PollerSpec trigger(Trigger trigger) { return new PollerSpec(trigger); }
@Bean(name = PollerMetadata.DEFAULT_POLLER) public PollerMetadata poller() { return Pollers.fixedRate(500).get(); }
.poller(p -> p .fixedDelay(10) .maxMessagesPerPoll(1) .receiveTimeout(10))) .handle(new BeanFactoryHandler(), e -> e.id("anId"));
/** * Specify a {@link TransactionInterceptor} {@link Advice} with default * {@code PlatformTransactionManager} and * {@link org.springframework.transaction.interceptor.DefaultTransactionAttribute} for * the {@code pollingTask}. * @return the spec. */ public PollerSpec transactional() { TransactionInterceptor transactionInterceptor = new TransactionInterceptorBuilder().build(); this.componentsToRegister.put(transactionInterceptor, null); return transactional(transactionInterceptor); }
/** * Specify a {@link MessageChannel} to use for sending error message in case * of polling failures. * @param errorChannel the {@link MessageChannel} to use. * @return the spec. * @see MessagePublishingErrorHandler */ public PollerSpec errorChannel(MessageChannel errorChannel) { MessagePublishingErrorHandler errorHandler = new MessagePublishingErrorHandler(); errorHandler.setDefaultErrorChannel(errorChannel); this.componentsToRegister.put(errorHandler, null); return errorHandler(errorHandler); }
@Bean public IntegrationFlow supplierFlow2() { return IntegrationFlows.from(() -> "foo", c -> c.poller(Pollers.fixedDelay(100).maxMessagesPerPoll(1))) .<String, String>transform(String::toUpperCase) .channel("suppliedChannel2") .get(); }
@Bean(name = PollerMetadata.DEFAULT_POLLER) public PollerMetadata poller() { return Pollers.fixedRate(100).get(); }
/** * Specify a {@link TransactionInterceptor} {@link Advice} with the * provided {@code PlatformTransactionManager} and default * {@link org.springframework.transaction.interceptor.DefaultTransactionAttribute} * for the {@code pollingTask}. * @param transactionManager the {@link PlatformTransactionManager} to use. * @return the spec. */ public PollerSpec transactional(PlatformTransactionManager transactionManager) { return transactional(new TransactionInterceptorBuilder() .transactionManager(transactionManager) .build()); }
/** * Specify a bean name for the {@link MessageChannel} to use for sending error message in case * of polling failures. * @param errorChannelName the bean name for {@link MessageChannel} to use. * @return the spec. * @see MessagePublishingErrorHandler */ public PollerSpec errorChannel(String errorChannelName) { MessagePublishingErrorHandler errorHandler = new MessagePublishingErrorHandler(); errorHandler.setDefaultErrorChannelName(errorChannelName); this.componentsToRegister.put(errorHandler, null); return errorHandler(errorHandler); }
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(); }
/** * @param pollerMetadataSpec the pollerMetadataSpec * @return the endpoint spec. * @see org.springframework.integration.endpoint.AbstractPollingEndpoint * @see PollerSpec */ public S poller(PollerSpec pollerMetadataSpec) { Map<Object, String> components = pollerMetadataSpec.getComponentsToRegister(); if (components != null) { this.componentsToRegister.putAll(components); } return poller(pollerMetadataSpec.get()); }
/** * Specify a {@link TransactionInterceptor} {@link Advice} for the {@code pollingTask}. * @param transactionInterceptor the {@link TransactionInterceptor} to use. * @return the spec. * @see TransactionInterceptorBuilder */ public PollerSpec transactional(TransactionInterceptor transactionInterceptor) { return advice(transactionInterceptor); }
public static PollerSpec cron(String cronExpression, TimeZone timeZone) { return new PollerSpec(new CronTrigger(cronExpression, timeZone)); }
/** * Specify a {@link TransactionInterceptor} {@link Advice} with default * {@code PlatformTransactionManager} and * {@link org.springframework.transaction.interceptor.DefaultTransactionAttribute} for * the {@code pollingTask}. * @return the spec. */ public PollerSpec transactional() { TransactionInterceptor transactionInterceptor = new TransactionInterceptorBuilder().build(); this.componentsToRegister.put(transactionInterceptor, null); return transactional(transactionInterceptor); }
/** * Specify a {@link MessageChannel} to use for sending error message in case * of polling failures. * @param errorChannel the {@link MessageChannel} to use. * @return the spec. * @see MessagePublishingErrorHandler */ public PollerSpec errorChannel(MessageChannel errorChannel) { MessagePublishingErrorHandler errorHandler = new MessagePublishingErrorHandler(); errorHandler.setDefaultErrorChannel(errorChannel); this.componentsToRegister.put(errorHandler, null); return errorHandler(errorHandler); }
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(); }
@Override @Bean public IntegrationFlow flow() { return IntegrationFlows.from(Ftp.inboundAdapter(sf()) .filter(new FtpPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "rotate")) .localDirectory(new File(tmpDir, "variable")) .localFilenameExpression("#remoteDirectory + T(java.io.File).separator + #root") .remoteDirectory("."), e -> e.poller(Pollers.fixedDelay(1).advice(advice()))) .channel(MessageChannels.queue("files")) .get(); }
private static PollerSpec periodicTrigger(long period, TimeUnit timeUnit, boolean fixedRate, long initialDelay) { PeriodicTrigger periodicTrigger = new PeriodicTrigger(period, timeUnit); periodicTrigger.setFixedRate(fixedRate); periodicTrigger.setInitialDelay(initialDelay); return new PollerSpec(periodicTrigger); }