What is the recommended way to watch for changes in a Couchbase document?

I want to use Couchbase, but I want to implement change tracking in multiple areas like RethinkDB does.

There seems to be a hand full of ways I've been dragged from the Couchbase server.

  • DCP
  • TAP
  • XDCR

Which one is the right choice, or is there a better method?


UPDATE


Thanks @Kirk!
Thank you! it looks like DCP doesn't have a 100% API ready today (5/19/2015). Your ref blog helped me decide to use XDCR today and switch to DCP as soon as the official API is ready.

For XDCR, this GitHub Repo was helpful.

+3


source to share


2 answers


Currently, the only fully supported method is XDCR, which Kirk already mentioned. If you want to save time implementing it, you might want to base your code on this: https://github.com/couchbaselabs/couchbase-capi-server - it implements the server side of the XDCR protocol (v1). For example, the ElasticSearch plugin is based on this CAPI server. XDCR is a good choice if your application is a server / service that can wait for incoming connections, so Couchbase (or administrator) controls how and when Couchbase replicates data to your service.



Depending on what you want to accomplish, DCP may be a better choice later on because it is conceptually different from XDCR. Any DCP based solution will be pull-based (from your code side), so you have finer grained programmatic control over how and when to connect to the Couchbase bucket, and how to distribute your connections across processes if needed For a more detailed example of using DCP, check out the Couchbase-Kafka connector here: https://github.com/couchbase/couchbase-kafka-connector

+2


source


DCP is the right choice for this if it works according to your use case and you can write an application to consume the stream as there is no official API yet. Here is a blog post about this in java from one of the Couchbase Solutions Engine developers, http://nosqlgeek.blogspot.de/2015/05/dcp-magic.html

TAP is generally not recommended at this time. It's still in the product, but DCP is far superior to it in most cases.



XDCR can be used as it uses DCP, but you will need to write a plugin for XDCR. So you're just better off writing one to consume the DCP stream.

+1


source







All Articles