我使用spring集成和amqp实现了请求/答复。处理请求可能需要很长时间(在某些情况下甚至需要一个小时),由于某些原因,客户端抛出异常-
Exception in thread "main" org.springframework.integration.handler.ReplyRequiredException: No reply produced by handler 'client', and its 'requiresReply' property is set to true.我的客户端配置在下面。
<int-amqp:outbound-gateway
id="client"
request-channel="in"
reply-channel="res"
exchange-name="reportingServer"
routing-key-expression="'report.req.'+headers.id"
amqp-template="amqpTemplate" requires-reply="true">
</int-amqp:outbound-gateway>我相信回复超时默认值是-1,意思是无限期地等待,但不知道为什么它不能工作,任何帮助都将不胜感激。
另外,在amqp中实施如此长时间的等待操作是否存在已知的问题,还是应该是好的呢?
谢谢
发布于 2014-10-07 16:34:01
只要你没有太多的并发请求,它就会很好--如果你有成千上万的线程在等待回复,它就不会很好的扩展。
如果您需要扩展它,您可以用一对出站适配器和入站适配器设计一个异步等价,但它比使用网关要复杂一些,实际的实现将取决于流程的其余部分。本质上,您必须设置replyTo头,以使应答到达入站适配器。
如果在AMQP网关的上游有一个简单的<gateway/>,则需要确保replyChannel头没有丢失。 in this section。
https://stackoverflow.com/questions/26237489
复制相似问题