How to identify my collection name in DCP event

Hi all,

I am working on DCP Event listener…

Cocuchbase : 7.0.2
DCP : 0.37.0

Bucket: bucket
Scope: scope
Collection: collection1,collection2,collection3


final Client client = Client.builder()
.credentials(“Administrator”, “123456”)

public void onEvent(ChannelFlowController flowController, ByteBuf event) {


Question :

1. How i can identify my collection in onEvent() function. On which collection this event trigger ??

Hi Bhushan,

I’m obligated to remind everyone that the java-dcp-client library is not an officially supported product. Okay, now to answer your question :slight_smile:

Collection information is available via the high level API. Instead of registering separate data and control event handlers, you register a single DatabaseChangeListener.

The mutation, deletion, and expiration events sent to the listener all extend DocumentChange which has a getCollection() method that returns info about the collection, including the name.