Hazelcast-队列阅读

发布于 2025-01-27 20:27:09 字数 174 浏览 3 评论 0原文

我的项目中有这样的情况:A1,A2,A3和B1,B2,B3有两种不同类型的服务。

A只是服务A的许多实例,而B也是如此。

我的问题是: 我发布一个元素以在Hazelcast中排队,并希望仅通过一个实例和一个实例处理该元素。 A和B的实例。可以在一个队列中做到这一点吗?还是存在一种处理这种情况的不同方法?

I have such a situation in my project: there are two different types of services A1, A2, A3, and B1,B2,B3.

A's are just many instances of service A, and the same for B's.

My question is:
I publish an element to queue in hazelcast and want to process that element only by one instance of A and one instance of B. Topic can not be used because this is like broadcast to all instances and also the ItemListener for queue will be run for all instance of A's and B's. Is it possible to make this in a single queue? Or does it exists a different approach to deal with such a situation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

只等公子 2025-02-03 20:27:09

Hazelcast并未提供有关主题的消费者群体的概念。

如果您的物品很小,则可以将它们发布给2个队列(或者如果您拥有服务A,B,C ...)。

如果您的物品很大,并且重复它们会导致太多的开销,则可以将这些物品放入地图中,并仅将参考发布到队列中。

Hazelcast doesn't provide a concept of consumer groups for topics.

If your items are small you can publish them to 2 queues (or more in case you have services A, B, C...).

If your items are large and duplicating them would result in too much overhead you can put the items into a map and publish only a reference into the queue.

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