Closed adrien-candiotti closed 8 years ago
Same here.
I think that example in docs is not correct. It seems that consume message like this will solve the problem:
sub1.subscribe(function(message, done){
console.log("1: hello", message.place);
done();
});
Exactly, as it is a mix of promises and callback I didn't think that a second argument was given to the subscribe callback. I should have guessed tho, as it's a callback there.
It's working that way.
FWIW, I'll be updating the examples soon, to go along with some rather major changes that can be seen in the dev branch.
I realized a few days ago, that the error handling situation, among other things, was terrible at best. I've completely ripped apart the middleware, put it back together and made things more flexible by not assuming messages should be nack'd on error, etc.
The docs are not yet up to date in the dev branch, but if you look at the send/receive, req/res, and pub/sub specs, you'll see the new api that allows for things like this in the consumer:
myStuff.subscribe(function(message, properties, actions, next){
// do stuff
// check for errors
if (err) {
actions.nack();
return next(err);
} else {
actions.ack();
}
});
FYI - I've just released v0.7.0 of Rabbus, and have included major rework of the demos. They should be significantly easier to understand, and they all work properly now! :)
I just copied paste the example for the pub/sub scenario.
When I publish a message with the publisher I get this output:
1453908549421 [wascally.acknack] New pending tag 1 on queue pub-sub.queue - default 1: hello world
And messages are never removed from the queue : If I launch another subscriber I'll receive all the previously sent messages.
Seems like an ACK is not done well somewhere maybe?