繁体   English   中英

将 Spring 集成 xml 转换为 Java DSL - Inbound Channel 适配器中的调用方法

[英]Converting Spring integration xml to Java DSL - Invoke method in Inbound Channel adapter

我有一个 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>

如何将其更改为 Java DSL? 我试过下面的代码,但它不完整。 我不确定如何添加 '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(...)
    ...

在那里使用队列通道是没有意义的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM