Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong handlers get called if only one queue is used #31

Open
webhet opened this issue Nov 16, 2021 · 0 comments
Open

Wrong handlers get called if only one queue is used #31

webhet opened this issue Nov 16, 2021 · 0 comments

Comments

@webhet
Copy link

webhet commented Nov 16, 2021

If a configuration with only one queue is used, all handlers are called if any message is published.
If no queue is defined, the implementation creates a new queue per topic/handler and everything works fine.

The issue probably has to do with how the routingKey is passed on to the callback in amqp/subscriber.ts. If this were to pass on the routing key of the received message (msg.fields.routingKey) instead of the routing key that is passed into the subscribe function (and with which the binding is created) only the handlers for that specific routing key would get called.

The configuration I'm using:

new AMQPPubSub({
    connection: conn,
    exchange: {
       name: 'pub_sub_exchange',
       type: 'topic',
       options: {
         durable: false,
         autoDelete: true
       }
     },
     queue: {
       name: 'pub_sub_queue',
       options: {
         exclusive: true,
         durable: true,
         autoDelete: true
       },
       unbindOnDispose: false,
       deleteOnDispose: false,
     } 
  })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant