A drop-in replacement for the DistributedQueue that comes with the ZK distribution.
Creating a SimpleDistributedQueue
public SimpleDistributedQueue(CuratorFramework client, String path) Parameters: client - the client path - path to store queue nodes
Add to the queue
public boolean offer(byte[] data) throws Exception Inserts data into queue. Parameters: data - the data Returns: true if data was successfully added
Take from the queue
public byte[] take() throws Exception Removes the head of the queue and returns it, blocks until it succeeds. Returns: The former head of the queue
NOTE: see the Javadoc for additional methods
It is strongly recommended that you add a ConnectionStateListener and watch for SUSPENDED and LOST state changes.