Permalink
Browse files

updated readme

  • Loading branch information...
1 parent 4aeba14 commit 2912b044285ab7f17c9eca9dc3385881e5b89994 @jamescarr committed Apr 6, 2012
Showing with 25 additions and 0 deletions.
  1. +1 −0 examples/catch-all.js
  2. +24 −0 readme.md
View
@@ -19,6 +19,7 @@ conn.on('ready', function(){
conn.queue('mongoose-amqp-example', function(q){
q.bind('user', '#')
em.emit('subscribed');
+
q.subscribe(function(user, headers, deliveryInfo){
console.log(user);
console.log("routing key: " + deliveryInfo.routingKey)
View
@@ -47,6 +47,30 @@ User.plugin(mongoose_amqp, {
```
+That's it! Now when ever you save or remove a single model, a message
+will be published to the designated AMQP broker.
+
+So publishing a message is as simple as
+
+```javascript
+
+var user = new User({
+ name:'Homer Simpson'
+ , email:'homer@example.com'
+});
+
+user.save()
+
+```
+
+### Why!?
+For my usecase, I wanted my mongodb objects to be broadcasted to
+rabbitmq for delayed indexing in elasticsearch. I'm sure there are
+plenty of other use cases that this solution would be helpful.
+
+## Documentation
+
+
### Model.plugin(mongoose_amqp, options)
The first argument is obviously the plugin. The second argument is an

0 comments on commit 2912b04

Please sign in to comment.