亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

升級到 Spring Integration 5 后,使用消息不再起作用

升級到 Spring Integration 5 后,使用消息不再起作用

慕俠2389804 2022-11-02 10:52:07
我正在嘗試將使用 Spring Integration 4.3 和 Spring Boot 1.6 的項目升級到 Spring Integration 5.1 和 Spring Boot 2.1。以前我有以下配置:IntegrationFlows.from(Amqp.inboundAdapter(connectionFactory, "queueName")                    .id("myId")                    .autoStartup(autoStartup)                    .prefetchCount(10)                    .concurrentConsumers(2)                    .maxConcurrentConsumers(3)                    .messageConverter(messageConverter()))                    .aggregate(a -> a.correlationExpression("payload.entityId")                                    .releaseExpression("size() eq iterator().next().payload.batchSize")                                    .sendPartialResultOnExpiry(true)                                    .groupTimeout(2000)                                    .expireGroupsUponCompletion(true)                                    .outputProcessor(myMessageGroupProcessor))                    .handle(serviceActivatorBean, "myMethod", e -> e.advice(requestHandlerRetryAdviceForIntegrationFlow()))                    .get();在升級過程中,我嘗試按照此處的文檔進行操作,因此將配置更改為:@Configuration@EnableAutoConfiguration@EnableIntegrationpublic class SpringConfig {    @Bean(name = "myFlowId")    public IntegrationFlow myFlow(ConnectionFactory connectionFactory, ServiceActivatorBean serviceActivatorBean,                                  @Value("${spring.integration.flow.auto-startup:true}") boolean autoStartup,                                  MyMessageGroupProcessor myMessageGroupProcessor) {    }}但是,當我發布消息時,集成流似乎沒有接收/處理它們。我沒有收到任何錯誤日志(或者即使我啟用了調試日志記錄也沒有任何日志),而且我不太確定從哪里開始調試。我很肯定消息實際上已發布到 RabbitMQ,所以這不是問題。我會錯過什么?
查看完整描述

1 回答

?
撒科打諢

TA貢獻1934條經驗 獲得超2個贊

我的問題實際上不是由于 Spring Integration,而是與 Spring AMQP 的變化有關。以前的“可聲明”可以這樣創建:


@Bean

List<Binding> myBinding() {

    return List.of(<binding1>, <binding2>, ..)

}

但在 Spring AMQP 2.1 中,這應該更改為:


@Bean

Declarables myBinding() {

    return new Declarables(List.of(<binding1>, <binding2>, ..))

}

請參閱此處的文檔。


順便說一句,我releaseExpression的也錯了,應該是size() eq one.payload.batchSize。


查看完整回答
反對 回復 2022-11-02
  • 1 回答
  • 0 關注
  • 127 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號