本文整理汇总了Java中org.springframework.integration.annotation.InboundChannelAdapter类的典型用法代码示例。如果您正苦于以下问题:Java InboundChannelAdapter类的具体用法?Java InboundChannelAdapter怎么用?Java InboundChannelAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InboundChannelAdapter类属于org.springframework.integration.annotation包,在下文中一共展示了InboundChannelAdapter类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: poll
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的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);
}
示例2: poll
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的package包/类
@InboundChannelAdapter(value = SleuthSource.OUTPUT)
public Spans poll() {
List<Span> result = new ArrayList<>();
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;
}
this.spanMetricReporter.incrementAcceptedSpans(result.size());
return new Spans(this.endpointLocator.locate(result.get(0)), result);
}
示例3: fileMessageSource
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的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;
}
示例4: stockPriceChangeEvent
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的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
示例5: receive
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的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);
}
};
}
示例6: timerMessageSource
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的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");
}
};
}
示例7: timerMessageSource
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的package包/类
@Bean
@InboundChannelAdapter(Source.OUTPUT)
public MessageSource<String> timerMessageSource() {
return new MessageSource<String>() {
@Override
public Message<String> receive() {
return MessageBuilder.withPayload(new SimpleDateFormat("DDMMMYYYY").format(new Date())).setHeader(MessageHeaders.CONTENT_TYPE,"text/plain").build();
}
};
}
示例8: xmlSource
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的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;
}
示例9: timerMessageSource
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的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()));
}
示例10: timerMessageSource
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的package包/类
@InboundChannelAdapter(value = Source.OUTPUT)
public String timerMessageSource() {
return new SimpleDateFormat(this.options.getFormat()).format(new Date());
}
示例11: fooBarStrings
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的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");
}
示例12: timeSensorSource
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的package包/类
@Bean
@InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "${fixedDelay}", maxMessagesPerPoll = "1"))
public MessageSource<Sensor> timeSensorSource(){
return () -> new GenericMessage<Sensor>(randomSensor());
}
示例13: timerMessageSource
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的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()));
}
示例14: timerMessageSource
import org.springframework.integration.annotation.InboundChannelAdapter; //导入依赖的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()));
}