'Hazelcast - queue reading

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?



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 FrantiĊĦek Hartman