Hazelcast-队列阅读
我的项目中有这样的情况: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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.