当前位置: 首页>>代码示例>>Java>>正文


Java Poller类代码示例

本文整理汇总了Java中org.springframework.integration.annotation.Poller的典型用法代码示例。如果您正苦于以下问题:Java Poller类的具体用法?Java Poller怎么用?Java Poller使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Poller类属于org.springframework.integration.annotation包,在下文中一共展示了Poller类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: poll

import org.springframework.integration.annotation.Poller; //导入依赖的package包/类
@InboundChannelAdapter(value = SleuthSource.OUTPUT, poller = @Poller(POLLER))
public Spans poll() {
	List<Span> result = new LinkedList<>();
	this.queue.drainTo(result);
	for (Iterator<Span> iterator = result.iterator(); iterator.hasNext();) {
		Span span = iterator.next();
		if (span.getName() != null && span.getName().equals("message/" + SleuthSource.OUTPUT)) {
			iterator.remove();
		}
	}
	if (result.isEmpty()) {
		return null;
	}
	if (log.isDebugEnabled()) {
		log.debug("Processed [" + result.size() + "] spans");
	}
	this.spanMetricReporter.incrementAcceptedSpans(result.size());
	return new Spans(this.endpointLocator.locate(result.get(0)), result);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:20,代码来源:StreamSpanReporter.java

示例2: fileMessageSource

import org.springframework.integration.annotation.Poller; //导入依赖的package包/类
@Bean
@InboundChannelAdapter(value = "inboundFileChannel", poller = @Poller(cron = "${ticket.poller.cron}"))
public MessageSource<File> fileMessageSource(@Value("${ticket.poller.path}") final String path,
                                             @Value("${ticket.poller.fileMask}") final String fileMask) {
    final FileReadingMessageSource source = new FileReadingMessageSource();
    final CompositeFileListFilter<File> compositeFileListFilter = new CompositeFileListFilter<>();
    final SimplePatternFileListFilter simplePatternFileListFilter = new SimplePatternFileListFilter(fileMask);
    final AcceptOnceFileListFilter<File> acceptOnceFileListFilter = new AcceptOnceFileListFilter<>();
    compositeFileListFilter.addFilter(simplePatternFileListFilter);
    compositeFileListFilter.addFilter(acceptOnceFileListFilter);
    source.setFilter(compositeFileListFilter);
    source.setDirectory(new File(path));
    return source;
}
 
开发者ID:create1st,项目名称:spring-batch,代码行数:15,代码来源:IntegrationConfiguration.java

示例3: stockPriceChangeEvent

import org.springframework.integration.annotation.Poller; //导入依赖的package包/类
@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();
	};
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Spring-5.0,代码行数:16,代码来源:SignificantStockChangeSourceApplication.java

示例4: receive

import org.springframework.integration.annotation.Poller; //导入依赖的package包/类
@Bean
@InboundChannelAdapter(value = MultiOutputSource.OUTPUT1, poller = @Poller(fixedDelay = "1000", maxMessagesPerPoll = "1"))
public synchronized MessageSource<String> messageSource1() {
	return new MessageSource<String>() {
		public Message<String> receive() {
			String message = "FromSource1";
			System.out.println("******************");
			System.out.println("From Source1");
			System.out.println("******************");
			System.out.println("Sending value: " + message);
			return new GenericMessage(message);
		}
	};
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-samples,代码行数:15,代码来源:SampleSource.java

示例5: timerMessageSource

import org.springframework.integration.annotation.Poller; //导入依赖的package包/类
@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");
		}
	};
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream,代码行数:11,代码来源:CustomPartitionedProducerTest.java

示例6: xmlSource

import org.springframework.integration.annotation.Poller; //导入依赖的package包/类
@Bean
@InboundChannelAdapter(value = "pdfCreatorInputChannel", poller = @Poller("xmlFilePoller"))
public MessageSource<File> xmlSource() {
	FileReadingMessageSource source = new FileReadingMessageSource();
	source.setDirectory(config.getXmlDir());
	source.setAutoCreateDirectory(true);
	source.setFilter(new CompositeFileListFilter<>(
			Arrays.asList(
					new AgeFileListFilter(config.getXmlFileAge()),
					new AcceptOnceFileListFilter<File>(config.getXmlSeenFilesQueueSize()),
					new RegexPatternFileListFilter(config.getXmlFilePattern())
			)));
	return source;
}
 
开发者ID:djarosz,项目名称:fopator,代码行数:15,代码来源:Fopator.java

示例7: timerMessageSource

import org.springframework.integration.annotation.Poller; //导入依赖的package包/类
@Bean
@InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "${fixedDelay}", maxMessagesPerPoll = "1"))
public MessageSource<String> timerMessageSource() {
	return () -> new GenericMessage<>(new SimpleDateFormat(this.format).format(new Date()));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-samples,代码行数:6,代码来源:SourceModuleDefinition.java

示例8: fooBarStrings

import org.springframework.integration.annotation.Poller; //导入依赖的package包/类
@Bean
@InboundChannelAdapter(channel = Source.OUTPUT, poller = @Poller(fixedDelay = "100"))
public MessageSource<String> fooBarStrings() {
	return () ->
			new GenericMessage<>(this.semaphore.getAndSet(!this.semaphore.get()) ? "foo" : "bar");
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-samples,代码行数:7,代码来源:FooBarSource.java

示例9: timeSensorSource

import org.springframework.integration.annotation.Poller; //导入依赖的package包/类
@Bean
@InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "${fixedDelay}", maxMessagesPerPoll = "1"))
public MessageSource<Sensor> timeSensorSource(){
	return () -> new GenericMessage<Sensor>(randomSensor());
}
 
开发者ID:viniciusccarvalho,项目名称:schema-evolution-samples,代码行数:6,代码来源:SensorSource.java

示例10: timerMessageSource

import org.springframework.integration.annotation.Poller; //导入依赖的package包/类
@Bean
@InboundChannelAdapter(value = Source.OUTPUT, autoStartup = "false", poller = @Poller(fixedDelay = "${fixedDelay}", maxMessagesPerPoll = "1"))
public MessageSource<String> timerMessageSource() {
	return () -> new GenericMessage<>(new SimpleDateFormat(this.options.getFormat()).format(new Date()));
}
 
开发者ID:trisberg,项目名称:cloud-examples,代码行数:6,代码来源:TimeSource.java

示例11: timerMessageSource

import org.springframework.integration.annotation.Poller; //导入依赖的package包/类
@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()));
}
 
开发者ID:spring-projects,项目名称:spring-bus,代码行数:6,代码来源:ModuleDefinition.java

示例12: aggregate

import org.springframework.integration.annotation.Poller; //导入依赖的package包/类
@Aggregator(sendPartialResultsOnExpiry = true, sendTimeout = RECEIVE_TIMEOUT, inputChannel = "inboundResults", outputChannel = "replyChannel",
        poller = @Poller(maxMessagesPerPoll = "5", fixedDelay = "10000"))
public List<?> aggregate(@Payloads List<?> messages) {
    return messages;
}
 
开发者ID:cegeka,项目名称:batchers,代码行数:6,代码来源:EmployeeJobConfigMaster.java


注:本文中的org.springframework.integration.annotation.Poller类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。