question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect subscriber handle called

See original GitHub issue

This seems like a bug or a wrong usage on my side, please let me know if you experienced something similar.

We have a topic exchange with different microservices sending events to an audit log service. In the audit log service we have an @Injectable() subscriber class with several @RabbitSucribe() handlers, designed to handle different types of events based on routingKey.

The routing key is of form “service.action.object” and the handlers’ routing key templates are correspondingly, *.created.*, *.updated.*, *.deleted.*, etc. They do very similar things, so I didn’t notice at start, but seems even though all data in the message is correctly sent (especially the routing key), the handlers are not consistently called based on the defined template.

For example, an admin.deleted.User message might end up being handled by the created or updated handler…

We tried to get to the bottom of this, but can’t find anything wrong with our setup or code. Also noticed that if I break up the 1 subscriber class, into several @Injectable() classes, each with only 1 @RabbitSucribe() handler - the issue goes away.

Is it wrong to use multiple @RabbitSucribe() inside one class? Or is there another issue down the line?

EDIT: In fact the separated subscribers with 1 handler also doesn’t work (only looked working at start). So what exactly might be the issue?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
WonderPandacommented, Dec 10, 2020

@Sikora00 Please review the RabbitMQ patterns documentation around message routing and exchanges. Both of these two links are very valuable in understanding how things work under the hood when it comes to these concepts. Don’t worry about the code samples since @golevelup/nestjs-rabbitmq abstracts away most of that for you. What is important is that you take a look at the diagrams and concepts being presented so that you understand the relationship between routing, queues and consumers.

Understanding these concepts will make it much easier for you to leverage RabbitMQ across any programming language or library

https://www.rabbitmq.com/tutorials/tutorial-four-javascript.html https://www.rabbitmq.com/tutorials/tutorial-five-javascript.html

0reactions
WonderPandacommented, Dec 14, 2020

I’m closing this for now because it works as intended based on the underlying RabbitMQ implementation. If there are additional issues related to this feel free to open or create a new issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

31 - Subscriber and policyholder name mismatched. - Therabill
Invalid / Missing / Incorrect insured's information. Surprisingly, sometimes a misspelled name can cause this error. Or maybe the birthdate is ...
Read more >
Subscriptions in Apollo Server - Apollo GraphQL Docs
The subscribe function must return an object of type AsyncIterator , a standard interface for iterating over asynchronous results. In the above postCreated....
Read more >
Handle message failures | Cloud Pub/Sub
This page explains how to handle such processing failures by using a subscription retry policy or by forwarding undelivered messages to a dead-letter...
Read more >
Publish–subscribe pattern - Wikipedia
In software architecture, publish–subscribe is a messaging pattern where senders of messages, called publishers, ... In GUI systems, subscribers can be coded to...
Read more >
Response Status and Error Codes - Infobip
Defined value for the duration of the call is invalid and must be a ... There has been a mobile subscriber equipment error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found