2017-07-26 99 views
0

我有Spring集成和输入/输出通道的项目。问题是,在最后一块配置如何关闭春季整合渠道?

<int:transformer id="testTransformer" input-channel="inChannel" method="processor" 
     output-channel="outChannel"> 
      <bean class="someClass"/> 
     </int:transformer> 

的它给了我一个错误

failure occurred in gateway sendAndReceive: No reply produced by handler 'testTransformer', and its 'requiresReply' property is set to true 

据我所知,这是关于我的outputChannel没有初始化,那么如何正确地作出计划完成了吗?

回答

0

无应答的处理程序“testTransformer”产生的,它的“requiresReply”属性设置为true

这意味着transformer组件严格要求回复,它肯定有返回的东西。

这不是你的配置问题,而是你在someClass.processor()方法中的逻辑。重新考虑它会返回任何有价值的东西,而不是null

如果null有可能通过您的逻辑,并且以某种方式管理它,请考虑切换到service-activator。这个答复并不严格,允许返回null。但同时你应该记住流量在这里完全停止。 null对消息传递无效,并且是一个指示器,因为没有什么是​​。