mateodelnorte / servicebus

Simple service bus for sending events between processes using amqp.
MIT License
420 stars 66 forks source link

Bug: unsubscripe fails for multiple subscriptions on persistent queue #76

Closed baranga closed 8 years ago

baranga commented 8 years ago

This PR does not fix the issue but introduces tests to prove the issue.

The issue: multiple subscriptions on a persistent queue get created and destroyed via unsubscribe calls afterwards. It is expected that after successful unsubscribing no more events are received. Right now the callback provided to subscribe still gets called after unsubscribtion.

baranga commented 8 years ago

@mateodelnorte I have no clue to how to fix this. Maybe something in amqplib broken?

baranga commented 8 years ago

Ok, possibly I identified the issue: bus/rabbitmq/pubsubqueue.js#L121 Each successful subscribe call overwrites subscription.consumerTag. So after second subscribe call PubSubQueue forgot about first subscribe.

baranga commented 8 years ago

Made subscription data local to subscribe call so it now allows multiple subscribes.

mateodelnorte commented 8 years ago

fantastic. looks great.

mateodelnorte commented 8 years ago

published to servicebus@2.0.5