Implement Publish Subscribe


#1

How can I implement publish subscribe model.
My situation is i have n writer and y reader. I want the readers to be able to get any modified/new document which is as per there subscription.
Also is it possible to simulate server side procedures.
regards


#2

Here some answers/comments from the Couchbase mailing list :
You do not have such feature inside the product, but you can probably simulate it using the XDCR protocol.
Here the comment from Jasdeep (@scalabl3)

You can use XDCR with a custom connector, check out my github: https://github.com/scalabl3/couchbase-xdcr-sinatra which simulates a Couchbase Server but then when it receives data I can do what I want with it. In your case you would make an interface that could manage subscriptions and react to them, and when it received the appropriate event (document mutation) it would perform the required action.
For fun, I was doing this with it: http://cl.ly/image/0a2y0H2X0U2o
However your workers can do whatever you want them to do, i.e. send push notifications, or pubsub over sockets, or send emails, etc.
Please note, XDCR requires significant enough resources to not be feasible to use on an AWS small or medium, go with at least a large as it requires CPU.