Couchbase eventing inside java

Hi All,

I have done Couchbase evening from event function and able to call my Java REST endpoint using CURL.
Couchbase event => JS Function == CURL ==> Java Rest end point

Instead of using such long process , Couchbase have any producer … where Couchbase can able to produce all those event and in Java application we can listen all those event directly.

Couchbase event => Producer:8080 ---------------- Consumer:8080 => JAVA app


Hi @bphalak
It sounds like you want to receive a stream of all mutations. If so, have you seen the Java DCP client?

yes i saw … but its not recommended… and also not supported for Delete …

Hi @bphalak
Where did you see that it’s not recommended and not supported for deletes? You will get deletion events over DCP.

As for the recommendation aspect, I can’t put it better than @david.nault in that linked post: The client is not officially supported, but it’s a well-maintained library used by the official Couchbase Spark, Kafka, and Elasticsearch connectors.

@bphalak We do not know your mutation workload. DCP can easily overwhelm your event receivers/consumers if the workload is too high. Eventing is useful in case you want to run custom JavaScript logic against every mutation to qualify if the mutation is of interest to your consumers or not and decide whether to pass on the event downstream. Eventing also helps in automatic load balancing and distribution of mutation processing workloads. It helps in rebalance & node failover scenarios as well. All of these you’d have to manage yourself if you decide to handle every mutation in your Java application. Cc @jon.strabala

Hi @bphalak,

You might want to read a new blog post on best practices (Eventing + curl with retry) as it might help with your “Couchbase event => JS Function == CURL ==> Java Rest end point” use case here: Couchbase Eventing Handling Errors and Retries - The Couchbase Blog

I have also reached out to you concerning your desire for a direct " Couchbase event => Producer:8080 <==> Consumer:8080 => JAVA app" via a DM as this feature is definitely a high priority.

One last item, in addition there is current work on implementing a Java SDK to control and drive Eventing.


Jon Strabala
Principal Product Manager - Server‌