Browse files

Note on unsubscribe in README

  • Loading branch information...
1 parent a3d33a5 commit 14f76259bcf4163950cd2d815a8652c1695efc49 @squaremo squaremo committed Oct 18, 2011
Showing with 20 additions and 0 deletions.
  1. +20 −0 README.md
View
20 README.md
@@ -188,6 +188,26 @@ Look at the source code if you need to do this.
This method will emit 'basicConsumeOk' when ready.
+### queue.unsubscribe(consumerTag)
+
+Unsubscribe from a queue, given the consumer tag. The consumer tag is
+supplied to the *promise callback* of `Queue.subscribeRaw` or
+`Queue.subscribe`:
+
+ connection.queue('foo', function(queue) {
+ var ctag;
+ queue.subscribe(function(msg) {...})
+ .addCallback(function(ok) { ctag = ok.consumerTag; });
+ ...
+ queue.unsubscribe(ctag);
+ });
+
+Note that `Queue.unsubscribe` will not requeue messages that have not
+been acknowledged. You need to close the queue or connection for that
+to happen. You may also receive messages after calling `unsubscribe`;
+you will **not** receive messages from the queue after its promise
+callback has been invoked, however.
+
### queue.shift()
For use with `subscribe({ack: true}, fn)`. Acknowledges the last

0 comments on commit 14f7625

Please sign in to comment.