Ack specific message #76

fernandomm opened this Issue Mar 6, 2012 · 6 comments


None yet
4 participants


I'm using ack: true and prefetchCount: 0 in my queue. I know that i have to use queue.shift() to ack my messages but from i've read this will ack the last message.

Is there a way to ack a specific message? Example: using message variable in the callback of queue.subscribe.

naholyr commented May 9, 2012

At that point, q.shift() will even totally fail if you use a prefetchCount > 1 !

I use this workaround:

q.subscribe(function (...) {
  var msg = q.currentMessage; // you can later use "msg.acknowledge()"

It's a real bug in case of prefetchCount != 1 (especially if > 1) so I may propose a pull request very soon.

naholyr commented May 9, 2012

In reality, it's not documented but original Message object is available in the callback since 22 Nov 2011...

q.subscribe(function (message, headers, info, originalMessageObject) {

I would love a confirmation that this is really stable, but as it's been here for more than 6 months I think we can count on it ;)

baio commented Jun 25, 2012

Any update of this issue? Can I still use it as solution for my project?

naholyr commented Jun 25, 2012

We at @dijiwan use it on production. You can use it, it's working fine.

I'd rather see some documentation about it, so that we're absolutely certain this API won't change without notifications.

baio commented Jun 25, 2012

Ok, thanks!

I just wanted to say think you to pointing out this hidden parameter As i was wondering the same thing. It is one serious flaw of this library i have found that many things are undocumented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment