Skip to content

Commit

Permalink
Note on unsubscribe in README
Browse files Browse the repository at this point in the history
  • Loading branch information
squaremo committed Oct 18, 2011
1 parent a3d33a5 commit 14f7625
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Expand Up @@ -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
Expand Down

0 comments on commit 14f7625

Please sign in to comment.