DCP client code in Python or C?

I’m using Couchbase as a replicated document store without making use of much of the data processing / querying / etc capabilities. The data is small and relatively static, but I also have logs and status information from multiple external machines that will be streaming to server-side applications. Since Couchbase already handles failover well, I hope to bounce this data through Couchbase but would need a mechanism to trigger external commands on document change.

It looks like DCP would be the way to go in the current release. I found the python-dcp-client repo, but it was last modified 3 years ago and doesn’t appear to work out of the box.

I’ve seen hints of an upcoming events interface, but it’s not clear if this would be quite what I need.

A little help please?

Would suggest looking at the Couchbase 5.5 release, currently in developer preview.

It has a new Eventing service that might be exactly what you’re looking for.

1 Like

You can try out the Eventing Service in the Couchbase Server 5.5 Developer Previews, which are available now (under “Pre-release” tab). Any feedback would be greatly appreciated.

For more information about Developer Previews and the up and coming Eventing Service:

I’ll look into it, but have a couple concerns. First, I’m wary to integrate with something so new and prefer to work with a mechanism that has been “in the wild” for an extended period of time.

My larger concern is that one of the tasks I need to perform on modified documents is to extract a portion of the document, transform it, and upload the content into an influxdb time series database. The format transformations are extremely simple, but in my initial reading of the eventing documentation I see no mention of calling external programs except in a “send email” context. I feel like I could probably shoehorn my task into the eventing framework assuming I can open a TCP socket during the data processing phase, but a simple “a document you care about changed” message coming through a socket to an external application would be a better fit for my needs. This is why I was looking at DCP as a solution. My initial hack to get something working will probably consist of polling a set of documents, but an event driven solution is preferred.

Can you point me to the specifics of the eventing service that would support what I want to do or to example code of using DCP in C or Python?

You can call curl from the eventing service, so when a document is changed you can call the http endpoint of Influx to store any info that you need to.


That blog post has some examples on how to call curl.

Unfortunately this is also true for a Python and C++ DCP client.

There are no DCP clients that are currently supported. With Eventing we are actively working on it and plan to support it in future releases.

I’ll definitely look into using curl to kick the data over. Apparently I had missed that bit, but it looks like it might be a very good solution for this task. Thanks for the pointer.

Well, thanks for the direct answer. If no DCP clients are supported, was there any way at all to trigger operations on document modification? I know I could always poll a document’s version or modification date, but is the new Eventing framework the first way to officially avoid active polling?

Depends on where document mutation originated.

If it was in an application then that should have put the event on a pubsub system. It becomes a little more tricky when it comes to document expiry or document updates via n1ql queries (or edits in the console).

Interesting. I could probably use an external pubsub system for my purposes, but I’ll try out the Eventing once I set up the new release in my environment.

Thanks for your help.