Azure 队列异步消息
我们正在考虑单独的队列:
- 请求(RequestQueue)
- 响应(响应队列)
场景:
- 辅助角色会将消息放入 RequestQueue,例如 GetOrders
- 第三方将监控RequestQueue。如果他们看到 GetOrders 请求他们将获取消息,处理它们并将响应放入 响应队列。
问题: 如果我将消息放入 RequestQueue,我会希望从 ResponseQueue 获取结果。有没有简单的方法可以实现这一目标以及如何实现?
谢谢。
We are thinking of speparate Queues for:
- Request (RequestQueue)
- Response (ResponseQueue)
Scenario:
- Worker role will putMessage to RequestQueue e.g. GetOrders
- Third party will monitor RequestQueue. If they see GetOrders
request they will getMessage, process them and put the response in
ResponseQueue.
Question:
If I putMessage to RequestQueue, I will like to get results back from ResponseQueue. Is there easy way to achieve this and how?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,这是不可能的。如果将消息放入队列中,则必须从同一队列中弹出该消息(它不会神奇地出现在任何其他队列中)。也许如果您更多地解释为什么您认为这里需要两个单独的队列来进行推送/弹出,可能会有更广泛的答案和建议。
编辑:也许我误解了你的意图。我想我现在不明白这个问题 - 你能帮忙澄清一下吗?您似乎在问如何将一条消息放入一个队列,通过将另一条消息放入另一个队列来确认它,并让某人从第二个队列读取确认?这里的问题是什么?我应该指出,您不会希望某些第三方直接从 Windows Azure 队列中读取数据,因为这需要与他们共享主存储密钥(不可能)。也许您正在寻找如何让第三方从队列中读取数据?
编辑 2:听起来您想与第 3 方一起使用消息。正如我提到的,由于安全原因(您需要共享主密钥),Windows Azure 队列可能不太适合。相反,您可以在队列上分层 WCF 服务(通过代理使用队列)或使用服务总线中的队列 - 这将允许您拥有单独的凭据。就简单性而言,使用服务总线功能可能是正确的选择。请在此处查看演示。
No, this is not possible. If you put a message in a queue, you must pop the message from the same queue (it will not magically appear in any other queue). Perhaps if you explained more why you think you need two separate queues here for push/pop, there might be a more expansive answer and suggestion.
EDIT: Perhaps I misunderstood your intent. I guess I don't get the question now - can you help clarify. You seem to be asking how to put a message on one queue, acknowledge it by putting another message on another queue, and have someone read the acknowledgment from the second queue? What is the question here? I should point out that you won't want some 3rd party to read directly from a Windows Azure queue as that would require sharing the master storage key with them (a non-starter). Perhaps you are looking for how to have 3rd parties read from a queue?
EDIT 2: Sounds like you want to consume messages with a 3rd Party. Windows Azure queues probably are not a good fit as I mentioned due to security reasons (you need to share the master key). Instead, you could either layer a WCF service over the queue (using queues via proxy) or use the queueing from the Service Bus - that will allow you to have separate credentials. Using the Service Bus capability might be the right choice here in terms of simplicity. Take a look here for demos.
让某种工作人员监视问题队列,然后将答案发布到答案队列。连接队列管理器,使用任何类型的队列技术都不应该遇到任何问题。此外,工作人员实际上并不需要使用队列来获取答案。
注意事项:
Have a worker of some sort monitor the question queue, then post an answer to the answer queue. Interface out the queue managers and you shouldn't have any problems using any sort of queue tech. Also, the worker doesn't really need to use a queue for answers..
Caveats: