Usecase to use Couchbase bucket as a queue

Is there any usecase or documentation of using couchbase bucket as a message queue?

Hi Kayzid,

CouchbaseQueue can be used as as a building block for lightweight message queueing. Not as robust or scalable as something like RabbitMQ or Kafka, but good enough for some use cases.

It’s an implementation of the java.util.Queue interface backed by a JSON Array document. All operations on it are atomic (with the atomicity enforced by Couchbase Server), so it’s safe for concurrent access across multiple app servers.

The above link is to the Java SDK 2.x docs. If you’re using SDK 3, obtaining a CouchbaseQueue instance looks like:

Collection myCollection = myBucket.defaultCollection();
Queue<MyMessage> queue = myCollection.queue("myQueue", MyMessage.class);