[英]Converting Spring integration xml to Java DSL - Invoke method in Inbound Channel adapter
I have a xml as follows:我有一个 xml 如下:
<int:inbound-channel-adapter id="tasksForResendingToAggregatorPoller" ref="taskProcessor"
method="getTaskIdForResendingToAggregator"
channel="resultAggregationChannel" auto-startup="false">
<int:poller max-messages-per-poll="-1" fixed-delay="#{1 * T(org.apache.commons.lang3.time.DateUtils).MILLIS_PER_HOUR}" receive-timeout="-1"/>
</int:inbound-channel-adapter>
<int:channel id="resultAggregationChannel" datatype="java.lang.Long">
<int:queue capacity="${maxNumberOfMessagesInBuffers}"/>
</int:channel>
How do I change this to Java DSL?如何将其更改为 Java DSL? I have tried below code but its incomplete.
我试过下面的代码,但它不完整。 Im not sure how to add the 'ref' and 'method' attribute.
我不确定如何添加 'ref' 和 'method' 属性。
@Bean(name= PollerMetadata.DEFAULT_POLLER)
public PollerMetadata defaultPoller() {
return Pollers.fixedDelay(DateUtils.MILLIS_PER_HOUR).receiveTimeout(-1).get();
}
@Bean
public MessageChannel resultAggregationChannel() {
return MessageChannels.queue(bceMaxNumberOfMessagesInBuffers).get();
}
@Bean
public IntegrationFlow taskAgregator() {
return IntegrationFlows.from("resultAggregationChannel")
.handle(getEnrichmentTaskIdForResendingToAggregator)
.get();
};
IntegrationFlows.from(() -> bean.method(), e -> e.poller(...))
.handle(...)
...
It doesn't make sense to use a queue channel there.在那里使用队列通道是没有意义的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.