Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hazelcast Queue Info

Tags:

java

hazelcast

I am currently writing a distributed system using hazelcast. I have a few questions regarding Queues implemented using hazelcast.

  1. What is the best way to process data from the Queue? I currently have threads on each "node" reading off the blocking queue processing the data. Is this correct or is there some class I am not aware of that takes care of this like JMS or messageListener?
  2. I see there is a time-to-live-seconds setting which will remove the entry from the Queue once expired. My question is... is there any way to detect the removal of an expired item from the Queue? I know there are Listeners but this does not help as this is fired on all the "nodes" and not just one. I am looking for a way of executing code for each expired message (similar to a dead letter queue).

Any input or advice on this matter would be greatly appreciated.

Thanks

like image 307
Paul Avatar asked Feb 02 '12 08:02

Paul


People also ask

What is queue capacity?

The capacity of a Queue is the number of elements the Queue can hold. As elements are added to a Queue, the capacity is automatically increased as required through reallocation.

How does Hazelcast store data?

Data in Hazelcast is usually stored in-memory (RAM) so that it's faster to access. However, data in RAM is volatile, meaning that when one or more members shut down, their data is lost. When you persist data on disk, members can load it upon a restart and continue to operate as usual.

What is continuous queuing in IMDG?

A continuous queue is a JMS queue with a message-driven bean (MDB) as a consumer. A continuous queue is predefined for enterprise services only and uses multi-threaded processing to provide better system performance.

How does a Hazelcast distributed map work?

Hazelcast distributes map entries onto multiple cluster members (JVMs). Each member holds some portion of the data. Distributed maps have one backup by default. If a member goes down, your data is recovered using the backups in the cluster.


1 Answers

  1. There is no other way at the moment. So you will have your threads on each node calling queue.take(). Hazelcast team is planning to add IQueue.addQueueConsumer(QueueConsumer) that will behave similar to JMS MessageListener

  2. You are right. Adding listeners is not good way of doing it as it is very expensive operation. You might want to create an issue for this at http://code.google.com/p/hazelcast/issues. It is surely nice to have feature.

-talip @ hazelcast

like image 189
Talip Ozturk Avatar answered Sep 19 '22 17:09

Talip Ozturk