我如何使用 NServiceBus 来做消费者竞争
我想到了nservicebus的文档 http://docs.pspecial.net/,但仍然困惑我如何才能做我想做的事。
我的目标是拥有一个Windows服务,生成任务并将它们放入队列中,在另一端,我需要一些消费者,只要谁有空,就从队列中获取任务,并执行消息中指定的工作。
谁能给我一些提示,我该如何继续?
谢谢
I went thought the document of nservicebus http://docs.particular.net/, but still confuse how can i do what i want to do.
My aim is to have a windows service, generate tasks and put them into a queue, on the other end, i need some consumers, whenever who is free, pick up a tasks from the queue, and do the job specify in the message.
can anyone give me some hint, how can i continue??
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发行商将完全按照您的要求进行操作。基本上,分发者将控制使用循环方式工作分配的n个节点。节点通过向分发者传递“我已准备好工作”消息来向分发者注册。然后分发器将这些消息放入队列中。当分发器收到真正的消息时,它将从队列中弹出第一个“我准备好了”消息,并将该消息转发到适当的节点。当节点完成消息处理时,他将向分发器发送一条新的“我准备好了”消息,该消息最终将位于队列的底部。
所以基本上,它会完全按照你的要求去做。
The distributor will do exactly what you are after. Basically the distributor will control n number of nodes which use a round robin style work allocation. The nodes register with the distributor by passing a "I'm ready for work" message to it. The distributor then puts these messages in a queue. When the distributor receives the real message, it will pop the first "I'm ready" message off the queue and forward the message onto the appropriate node. When the node then finishes processing the message, he'll send a new "I'm ready" message to the distributor which will end up on the bottom of the queue.
So basically, it'll do exactly what you want.