Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

15. Using Nonrelational Databases > À la Carte Message Queues

À la Carte Message Queues

Let’s combine all of what we’ve learned about how to effectively use CouchDB from Clojure to implement an asynchronous work queue based on the events being emitted into the logging database we considered earlier. First, a refresher on what that data looks like:

Example 15-4. Sample event data

{:evt-type "auth/new-user" :username "Chas"}
{:evt-type "auth/new-user" :username "Dave"}
{:evt-type "sales/purchase" :username "Chas" :products ["widget1"]}
{:evt-type "sales/purchase" :username "Robin" :products ["widget14"]}
{:evt-type "sales/RFQ" :username "Robin" :budget 20000}

Now, you could add a single watch for changes in the logging database, and instead of echoing those events to *out*, do something useful with them; that’s a perfectly valid thing to do, especially if your requirements are relatively simple. However, most real-world systems need some additional levers to pull to control event processing loads and more ably support modular design requirements.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial