On www.pcapr.net, we use couch as an event bus (besides other things) to be picked up a Helma (Java/JavaScript) thread for sending emails and such. For one thing, if we ever bring the site down for maintenance, all of the "pending" events just sit in persistent storage within couch and we can pull in all those events just by a single view sorted by timestamp. Obviously, each event itself is a JSON document. One advantage of this is event-rollup where you really only want to send one email that aggregates (map/reduce) a bunch of events into a single email to avoid spamming users.
I'm not sure if this is "best-practices", but it works like a charm and we don't have to resort to writing to a file or using memcache for this transient storage. K. On Mon, Feb 9, 2009 at 3:54 PM, Paul Carey <[email protected]> wrote: >> There's a lot of cool things you can do when you treat documents as >> state machines. Also, getting a view of "complete" bookings will be >> easy. >> >> Docs as state machines also works well in a multi-master environment, >> where you want to watch for "events" to be replicated to redundant >> storage. > > I've been using document state to allow some operations to be > idempotent - this has been working well. But I felt less comfortable > using state to effectively demarcate transactions. Your reply has > given me greater confidence with this approach. Thanks Chris. > > Paul >
