我如何使用 NServiceBus 来做消费者竞争

发布于 2024-10-06 21:53:55 字数 244 浏览 0 评论 0原文

我想到了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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

栖竹 2024-10-13 21:53:55

发行商将完全按照您的要求进行操作。基本上,分发者将控制使用循环方式工作分配的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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文