Regarding document updates notification


#1

Hi All,

We have a requirement to track all document updates of a particular bucket. But because of the rate at which the documents are updating and the number of documents in the bucket we have to avoid the usage of views for this.

We can make use of JAVA TAP API for this but the information available on this looks very limited, can some one please assist me to get more information on this?

Any help on this would be greatly appreciated?

Thanks,
Siva


#2

Hello,

What do you want to do when a document has been modified?

Can you do that from the Client API? for example wrapped the Couchbase SDK and capture the update here. Today Couchbase server does not allow you to capture event on the server, mainly to be sure that “custom code” will not impact global performance.

Yes you can use the TAP approach but may be hard to register all subscribed to all keyss

Regards
Tug
@tgrall


#3

You could have a look at this thread : http://www.couchbase.com/communities/q-and-a/tap-protocol-how-does-backfill-option-work-streaming-future-changes-only

We had the same requirement, but didn’t find our way out to a good solution

The good news is that : "In fact we are in the process of updating the TAP protocol and in the future plan to have a changes feed that could be directly consumed "


#4

Many thanks for the information provided Tug and Maxv. I’m able to configure an TAPClient to a Couchbase server bucket and receiving the update notifications from the same. Below is the piece of Java code i have written:

    URI base = new URI("http://10.0.0.9:8091/pools");
    List<URI> uris = new LinkedList<URI>();
    uris.add(base);
    TapClient tapClient = new TapClient(uris, "default", "");
    TapStream op = tapClient.tapBackfill("tapClient", 0, TimeUnit.SECONDS);
    System.out.println(tapClient.getMessagesRead());
    while (tapClient.hasMoreMessages()) 
              {
        ResponseMessage response = tapClient.getNextMessage();

        if (response != null) 
                {
            System.out.println("UpdatedKey : "+response.getKey() );
                 }
                 }

=======================================================================
This piece of code is working fine if we have single node in the cluster but if we have two nodes in a cluster it is giving duplicate messages i.e i’m receiving the updates for twice for the mutation of single document. Is this expected behavior of TAP protocol if we have multiple nodes configured in a cluster? If so is there a way to getaway with this problem and receive only one message per mutation?

Kindly share your views on this.

Thanks,
Siva


#5

I need to have the implementation in which all the other bucket users will get the notification as soon as any document is updated in the bucket in Couchbase 5.0.1 version. Can that be done using Java?

Thanks,
Vishal Khandelwal