如何配置接收器以满足以下要求
我有三个任务,将侦听单个队列“replyQueue”上的所有回复
task1
task2
task3
每个人都将在 Rabbit
上发送一条消息,并等待 replyQueue
的响应
任务1
-send message
-wait for the responses
-There can be multiple responses
-status message 1
-status message 2
-final message
TASK2
-send message
-wait for the responses
-There can be multiple responses
-status message 1
-status message 2
-final message
TASK3
-send message
-wait for the responses
-There can be multiple responses
-status message 1
-status message 2
-final message
现在我必须根据响应做不同的任务 . 我如何配置我的队列和听众?
我尝试了以下
template.send("TaskQueue",message);
Message response= template.receive("replyQueue");
但这将允许我只读一个响应,但我想读取每个任务的多个响应1
请指导 .
1 回答
除非我在你的问题中遗漏了一些东西,否则你可以简单地做多个
receive()
电话 .如果这些任务同时运行,则不能使用相同的回复队列 - 否则任务将获得彼此的回复 - 在这种情况下,您需要为每个回复队列使用不同的回复队列 .