CouchDB-like change feed

Hi there,

I know that this is a question that regularly surfaces…
Couchbase does not currently have a “change feed” similar to CouchDB; I’ve read several times that such a feature was “coming soon”, but AFAIK it’s still not there. Any update on the topic?

Thanks in advance,
Thomas

Up! (filling to reach 20 chars :smile:)

It’s not a public interface yet, but there is an experimental interface for this called DCP. It’s in the latest JVM core.

It will become a public interface subject to testing, docs. We also have some enhancements in mind.

How are you looking to use this? It would help @cihangirb, @tgreenstein and I prioritize our efforts if you could describe.

I’m evaluating the usage of Couch{DB | Base} as a distributed event log for event sourcing purpose.

From an application point of view, the requirement would be to:

  • get all changes since a specific DB version
  • from this version, get new versions pushed instantly to the client (the continuous mode in CouchDB)

Let me know if you need any more information. Thanks!

Yes, that would fit how DCP works and it can do what you need. That said, it is not public interface yet and we need to do more work (both on the server and on the client) to make it reliable in all corner cases and also in terms of general performance.

That said, in the meantime you can work around that by implementing a view which contains your events based on a timestamp (in the key) and then you query for specific time ranges on a given interval. Since in an event sourced system you do not delete events anyways, this might work quite nicely.

Thanks for your reply, will be looking forward to this feature to become public. Obviously (and as you mention) an update on the client-side is equally important in order to receive push updates.

Your suggestion of using views sounds actually quite good. The only risk is that a client pushes an event with a timestamp that would put the event before the reader’s current cursor, something that would not happen if we rely on the DB version that increases monotonically.

That is true, you’d need to make sure that the client also uses timestamps that are not “in the past”. I don’t have a specific roadmap for DCP official support, but we are actively working on it because it is needed in other places as well (for example our Kafka and Spark integrations).