curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Laidlaw <donlaid...@me.com>
Subject DistributedQueue - subscriber not receiving all messages
Date Wed, 02 Jul 2014 12:01:01 GMT
Hi All,

Despite the advice not to use Zookeeper for queues, I thought I would try 
it for a very low volume application rather than install a dedicated 
messaging system. I already had zookeeper, so it seemed like a decent fit.

I create a DistributedQueue<T> for my type and provide the serializer, path,
client, and the consumer interface. I then start it and immediately 
receive any messages that are already in the queue.

Meanwhile in another JVM (same machine) I connect to the same path with a 
DistributedQueue<T> with a null consumer interface parameter and send new 
messages. Those messages never get consumed by the consumer I created earlier.
I can start the zookeeper shell and actually see the messages in the path.
So I know the messages are there. If I stop the original consumer (stop the whole 
JVM, not just the DistributedQueue object)and start it again  then it 
will consume the messages that were waiting there.

I don't think this is the expected behavior, and I am not sure why it is 
happening. Can anyone see something I missed?

Java 8 on Mac OSX Mavericks, fully updated
Zookeeper 3.4.6
Curator 2.4.2

The Code ...


QueueBuilder<NodeStateEvent> builder = QueueBuilder.builder(
   curatorFramework,
   queueConsumer,
   new JsonQueueSerializer<>(NodeStateEvent.class),
   queuePath);

DistributedQueue<NodeStateEvent> queue = builder.buildQueue();
queue.start();

// At this point events already in the queue arrive and are processed by the
// queueConsumer without any issues. However, no newly queued events are
// ever received.

Don Laidlaw
866 Cobequid Rd.
Lower Sackville, NS
B4C 4E1
Phone: 1-902-576-5185
Cell: 1-902-401-6771


Mime
View raw message