简体   繁体   English

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

[英]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.

相关问题 Spring Integration DSL JDBC 入站通道适配器 - Spring Integration DSL JDBC inbound channel adapter Spring Integration入站通道适配器中的覆盖方法 - Override method in spring integration inbound channel adapter Spring Integration xml to java dsl - 如何定义入站/出站通道适配器,轮询器等 - Spring Integration xml to java dsl - how to define inbound/outbound channel adaptors, pollers, etc "Spring集成:自定义入站通道适配器没有此类方法异常" - Spring integration: no such method exception for custom inbound channel adapter 具有事务轮询器Java配置的Spring Integration JPA入站通道适配器 - Spring Integration JPA inbound channel adapter with transactional poller Java configuration Spring Integration Java DSL中的JPA出站通道适配器配置 - JPA outbound channel adapter config in Spring Integration Java DSL 在 Spring Integration 5 上使用 Spring Integration Java DSL 在入站通道上配置目录扫描器 - Configure a directory scanner on an inbound channel with Spring Integration Java DSL on Spring Integration 5 Spring Batch/集成入站通道适配器 - Spring Batch/Integration Inbound Channel Adapter 重试Spring Integration FTP入站通道适配器 - Retry Spring Integration FTP Inbound Channel Adapter Spring集成:JDBC入站通道适配器 - Spring Integration: JDBC inbound channel adapter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM