Spring integration Spring集成和DSL升级-单向';MessageHandler';而且它不是';不适合配置';输出通道';错误

Spring integration Spring集成和DSL升级-单向';MessageHandler';而且它不是';不适合配置';输出通道';错误,spring-integration,Spring Integration,升级上述jar文件后,我一直遇到以下问题: org.springframework.beans.factory.BeanCreationException: “当前组件” (org.springframework.integration.router。MethodInvokingRouter@5ddcc487) 是单向“MessageHandler”,不适合配置 “输出通道”。这是集成流程的结束。在 org.springframework.integration.dsl.IntegrationF

升级上述jar文件后,我一直遇到以下问题:

org.springframework.beans.factory.BeanCreationException: “当前组件” (org.springframework.integration.router。MethodInvokingRouter@5ddcc487) 是单向“MessageHandler”,不适合配置 “输出通道”。这是集成流程的结束。在 org.springframework.integration.dsl.IntegrationFlowDefinition.registerOutputChannelIfCan(IntegrationFlowDefinition.java:3053) 在 org.springframework.integration.dsl.IntegrationFlowDefinition.register(IntegrationFlowDefinition.java:2994) 在 org.springframework.integration.dsl.IntegrationFlowDefinition.handle(IntegrationFlowDefinition.java:1167) 在 org.springframework.integration.dsl.IntegrationFlowDefinition.handle(IntegrationFlowDefinition.java:987) 在 org.springframework.integration.dsl.IntegrationFlowDefinition.handle(IntegrationFlowDefinition.java:964) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

代码段:

public IntegrationFlow inBoundFlow(ConnectionFactory mqConnection)
    throws JMSException {

    return IntegrationFlows
            .from(Jms.messageDrivenChannelAdapter(mqConnection)
                    .configureListenerContainer(listenerContainer)
                    .destination(mqProperties.getQueue().getRequest())
                    .errorChannel(ErrorChannel())
                    .setHeaderMapper(new DefaultJmsHeaderMapper()))
            .filter(filterMessage, "filterMessage", m -> m.discardChannel(DiscardChannel()))
            .route(mqMessageRouter, "messageRouter")
            .handle(errorChannel, "handleError")
            .get();
}


@Named
public class MQErrorMessageChannel {

    @ServiceActivator(inputChannel = MQ_ERROR_MESSAGE_INPUT_CHANNEL, outputChannel = MQ_ERROR_MESSAGE_OUTPUT_CHANNEL)
    public Message<String> handleError(Throwable t) {
//Do Something....
        }
        return null;
    }
}
公共集成流inBoundFlow(ConnectionFactory mqConnection)
性感觉异常{
返回积分流
.from(Jms.messageDrivenChannelAdapter(mqConnection)
.configureListenerContainer(listenerContainer)
.destination(mqProperties.getQueue().getRequest())
.errorChannel(errorChannel())
.setHeaderMapper(新的DefaultJmsHeaderMapper())
.filter(filterMessage,“filterMessage”,m->m.discardChannel(discardChannel())
.route(mqMessageRouter,“messageRouter”)
.handle(错误通道,“handleError”)
.get();
}
@命名
公共类MQErrorMessageChannel{
@ServiceActivator(inputChannel=MQ\错误\消息\输入\通道,outputChannel=MQ\错误\消息\输出\通道)
公共消息句柄错误(可丢弃的t){
//做点什么。。。。
}
返回null;
}
}
任何指针?

这种方法调用形式中的
.route(mqMessageRouter,“messageRouter”)
完全是单向的,您不能在流中指向其后的任何内容

并没有严格的决定哪个通道将是路由器之后的下一个通道,所以我们不能从那个里继续流


只需将流分成几个部分,然后将该
.handle()
添加到每个特定的路由流中。

但是,如果希望不可路由的消息转到该
handle()
方法,则可以将
.defaultOutputParentFlow()
添加到路由器规范中。这是1.2中的一个更改(该行为以前是默认的)。请参阅。因此,即使MessageRouter具有此输入/输出通道注释,它也是单向配置的??重构可能不是我们最好的解决方案,因为很少有客户端应用程序使用这个模板框架。因此,我们需要尽量减少这种影响。公共接口MQMessageRouter{@Router(inputChannel=Router\u INPUT\u CHANNEL,defaultOutputChannel=Router\u OUTPUT\u CHANNEL)公共字符串messageRouter(字符串消息,映射头);}继续流定义时,
IntegrationFlow
outputChannel
注入
MessageHandler
的问题。如果将其声明为单独的组件,
IntegrationFlow
将无能为力。在注释级别上做得更多,因此,完全没有如何继续流的挂钩。我们决定修复
.route()
EIP方法,使其与
AbstractMessageRouter
的目的一致。正如Gary所说:要恢复以前的行为,应该使用
AbstractRouterSpec..DefaultOutputParentFlow()
。但是所有的注释声明都将被删除。