org.springframework.integration.annotation.Poller Java Examples
The following examples show how to use
org.springframework.integration.annotation.Poller.
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: DataProducer.java From spring-cloud with Apache License 2.0 | 6 votes |
@Bean @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "10000", maxMessagesPerPoll = "1")) public MessageSource<TimeInfo> timerMessageSource() { return () -> MessageBuilder.withPayload( TimeInfo.builder().time(Long.toString(System.currentTimeMillis())).label(UUID.randomUUID().toString()).build()) .build(); }
Example #2
Source File: FileCopyConfig.java From tutorials with MIT License | 5 votes |
@Bean @InboundChannelAdapter(value = "fileChannel", poller = @Poller(fixedDelay = "10000")) public MessageSource<File> fileReadingMessageSource() { FileReadingMessageSource sourceReader = new FileReadingMessageSource(); sourceReader.setDirectory(new File(INPUT_DIR)); sourceReader.setFilter(new SimplePatternFileListFilter(FILE_PATTERN)); return sourceReader; }
Example #3
Source File: TxIntegrationConfig.java From tutorials with MIT License | 5 votes |
@Bean @InboundChannelAdapter(value = "inputChannel", poller = @Poller(value = "pollerMetadata")) public MessageSource<File> fileReadingMessageSource() { FileReadingMessageSource sourceReader = new FileReadingMessageSource(); sourceReader.setDirectory(new File(INPUT_DIR)); sourceReader.setFilter(new SimplePatternFileListFilter(FILE_PATTERN)); return sourceReader; }
Example #4
Source File: CustomPartitionedProducerTest.java From spring-cloud-stream with Apache License 2.0 | 5 votes |
@Bean @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "5000", maxMessagesPerPoll = "1")) public MessageSource<String> timerMessageSource() { return new MessageSource<String>() { @Override public Message<String> receive() { throw new MessagingException("test"); } }; }
Example #5
Source File: CustomPartitionedProducerTest.java From spring-cloud-stream with Apache License 2.0 | 5 votes |
@Bean @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "5000", maxMessagesPerPoll = "1")) public MessageSource<String> timerMessageSource() { return new MessageSource<String>() { @Override public Message<String> receive() { throw new MessagingException("test"); } }; }
Example #6
Source File: PollingReceiverApplication.java From spring-cloud-gcp with Apache License 2.0 | 5 votes |
@Bean @InboundChannelAdapter(channel = "pubsubInputChannel", poller = @Poller(fixedDelay = "100")) public MessageSource<Object> pubsubAdapter(PubSubTemplate pubSubTemplate) { PubSubMessageSource messageSource = new PubSubMessageSource(pubSubTemplate, "exampleSubscription"); messageSource.setMaxFetchSize(5); messageSource.setAckMode(AckMode.MANUAL); messageSource.setPayloadType(String.class); return messageSource; }
Example #7
Source File: GcsSpringIntegrationApplication.java From spring-cloud-gcp with Apache License 2.0 | 5 votes |
/** * An inbound channel adapter that polls the remote directory and produces messages with * {@code InputStream} payload that can be used to read the data from remote files. * @param gcs a storage client to use * @return a message source */ @Bean @InboundChannelAdapter(channel = "copy-channel", poller = @Poller(fixedDelay = "5000")) public MessageSource<InputStream> streamingAdapter(Storage gcs) { GcsStreamingMessageSource adapter = new GcsStreamingMessageSource( new GcsRemoteFileTemplate(new GcsSessionFactory(gcs))); adapter.setRemoteDirectory(this.gcsReadBucket); return adapter; }
Example #8
Source File: GcsSpringIntegrationApplication.java From spring-cloud-gcp with Apache License 2.0 | 5 votes |
/** * An inbound channel adapter that polls the GCS bucket for new files and copies them to * the local filesystem. The resulting message source produces messages containing handles * to local files. * @param synchronizer an inbound file synchronizer * @return a message source */ @Bean @InboundChannelAdapter(channel = "new-file-channel", poller = @Poller(fixedDelay = "5000")) public MessageSource<File> synchronizerAdapter(GcsInboundFileSynchronizer synchronizer) { GcsInboundFileSynchronizingMessageSource syncAdapter = new GcsInboundFileSynchronizingMessageSource( synchronizer); syncAdapter.setLocalDirectory(Paths.get(this.localDirectory).toFile()); return syncAdapter; }
Example #9
Source File: GcsStreamingMessageSourceTests.java From spring-cloud-gcp with Apache License 2.0 | 5 votes |
@Bean @InboundChannelAdapter(value = "sortedChannel", poller = @Poller(fixedDelay = "100")) public MessageSource<InputStream> sortedChannelAdapter(Storage gcs) { GcsStreamingMessageSource adapter = new GcsStreamingMessageSource( new RemoteFileTemplate<>(new GcsSessionFactory(gcs)), Comparator.comparing(blob -> blob.getName())); adapter.setRemoteDirectory("gcsbucket"); adapter.setFilter(new AcceptOnceFileListFilter<>()); return adapter; }
Example #10
Source File: GcsStreamingMessageSourceTests.java From spring-cloud-gcp with Apache License 2.0 | 5 votes |
@Bean @InboundChannelAdapter(value = "unsortedChannel", poller = @Poller(fixedDelay = "100")) public MessageSource<InputStream> unsortedChannelAdapter(Storage gcs) { GcsStreamingMessageSource adapter = new GcsStreamingMessageSource(new RemoteFileTemplate<>(new GcsSessionFactory(gcs))); adapter.setRemoteDirectory("gcsbucket"); adapter.setFilter(new AcceptOnceFileListFilter<>()); return adapter; }
Example #11
Source File: SignificantStockChangeSourceApplication.java From Mastering-Spring-5.0 with MIT License | 5 votes |
@Bean @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "60000", maxMessagesPerPoll = "1")) public MessageSource<StockPriceChangeEvent> stockPriceChangeEvent() { StockTicker[] tickers = StockTicker.values(); String randomStockTicker = tickers[ThreadLocalRandom.current().nextInt(tickers.length)].name(); return () -> { StockPriceChangeEvent event = new StockPriceChangeEvent(randomStockTicker, new BigDecimal(getRandomNumber(10, 20)), new BigDecimal(getRandomNumber(10, 20))); logger.info("sending " + event); return MessageBuilder.withPayload(event).build(); }; }
Example #12
Source File: SftpConfig.java From java-examples with MIT License | 5 votes |
@Bean @InboundChannelAdapter(channel = "fromSftpChannel", poller = @Poller(cron = "0/5 * * * * *")) public MessageSource<File> sftpMessageSource() { SftpInboundFileSynchronizingMessageSource source = new SftpInboundFileSynchronizingMessageSource( sftpInboundFileSynchronizer()); source.setLocalDirectory(new File(sftpLocalDirectoryDownload)); source.setAutoCreateLocalDirectory(true); source.setLocalFilter(new AcceptOnceFileListFilter<File>()); return source; }
Example #13
Source File: DemoApplication.java From activiti-examples with Apache License 2.0 | 5 votes |
@Bean @InboundChannelAdapter(value = "fileChannel", poller = @Poller(fixedDelay = "1000")) public MessageSource<File> fileReadingMessageSource() { FileReadingMessageSource sourceReader = new FileReadingMessageSource(); sourceReader.setDirectory(new File(INPUT_DIR)); sourceReader.setFilter(new SimplePatternFileListFilter(FILE_PATTERN)); return sourceReader; }
Example #14
Source File: SampleSource.java From spring-cloud with Apache License 2.0 | 5 votes |
@Bean @InboundChannelAdapter(value = MultiOutputSource.OUTPUT2, poller = @Poller(fixedDelay = "1000", maxMessagesPerPoll = "1")) public synchronized MessageSource<String> messageSource2() { return new MessageSource<String>() { public Message<String> receive() { return new GenericMessage<String>("message2_" + UUID.randomUUID().toString()); } }; }
Example #15
Source File: SampleSource.java From spring-cloud with Apache License 2.0 | 5 votes |
@Bean @InboundChannelAdapter(value = MultiOutputSource.OUTPUT1, poller = @Poller(fixedDelay = "1000", maxMessagesPerPoll = "1")) public synchronized MessageSource<String> messageSource1() { return new MessageSource<String>() { public Message<String> receive() { return new GenericMessage<String>("message1_" + UUID.randomUUID().toString()); } }; }
Example #16
Source File: OrderApplication.java From Mastering-Spring-Cloud with MIT License | 4 votes |
@Bean @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "1000", maxMessagesPerPoll = "1")) public MessageSource<Order> ordersSource() { Random r = new Random(); return () -> new GenericMessage<>(new Order(OrderStatus.NEW, (long) r.nextInt(5), Collections.singletonList((long) r.nextInt(10)))); }
Example #17
Source File: SensorSource.java From schema-evolution-samples with Apache License 2.0 | 4 votes |
@Bean @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "${fixedDelay}", maxMessagesPerPoll = "1")) public MessageSource<Sensor> timeSensorSource(){ return () -> new GenericMessage<Sensor>(randomSensor()); }
Example #18
Source File: SensorSource.java From schema-evolution-samples with Apache License 2.0 | 4 votes |
@Bean @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "${fixedDelay}", maxMessagesPerPoll = "1")) public MessageSource<Sensor> timeSensorSource(){ return () -> new GenericMessage<Sensor>(randomSensor()); }
Example #19
Source File: ModuleDefinition.java From spring-bus with Apache License 2.0 | 4 votes |
@Bean @InboundChannelAdapter(value = "output", autoStartup = "false", poller = @Poller(fixedDelay = "${fixedDelay}", maxMessagesPerPoll = "1")) public MessageSource<String> timerMessageSource() { return () -> new GenericMessage<>(new SimpleDateFormat(format).format(new Date())); }
Example #20
Source File: EmployeeJobConfigMaster.java From batchers with Apache License 2.0 | 4 votes |
@Aggregator(sendPartialResultsOnExpiry = true, sendTimeout = RECEIVE_TIMEOUT, inputChannel = "inboundResults", outputChannel = "replyChannel", poller = @Poller(maxMessagesPerPoll = "5", fixedDelay = "10000")) public List<?> aggregate(@Payloads List<?> messages) { return messages; }
Example #21
Source File: TimeSourceApplication.java From tutorials with MIT License | 4 votes |
@Bean @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "10000", maxMessagesPerPoll = "1")) public MessageSource<Long> timeMessageSource() { return () -> MessageBuilder.withPayload(new Date().getTime()).build(); }
Example #22
Source File: SimpleTimeSourceApplication.java From rocketmq-binder-demo with Apache License 2.0 | 4 votes |
@Bean @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "10000", maxMessagesPerPoll = "1")) public MessageSource<Long> timeMessageSource() { return () -> MessageBuilder.withPayload(new Date().getTime()).build(); }