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.

RabbitMQ: Find a way to attach handlers to Nest Context

See original GitHub issue

The RabbitMQ module should be built such that it plays nicely with the existing Nest processing pipeline as far as the ability to integrate with other Nest components such as Pipes, Interceptors and Guards. The @nestjs/microservices package accomplishes this but it doesn’t appear that it exposes the necessary functionality to glue these things together in an easy to use way. The current approach of using ExternalContextCreator to build up the handler function doesn’t appear to be working currently.

RabbitMQ handlers (for both PubSub and RPC) should:

  • Work with Pipes
  • Work with Interceptors
  • Work with Guards

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:13

github_iconTop GitHub Comments

1reaction
mabuonomocommented, Jan 8, 2021

@WonderPanda, thankyou for your quick reply, yes the interceptor works very well, but I have some problem with the custom decorator.

For example:

export const ReportMessage = createParamDecorator((data: unknown, context: ExecutionContext) => {
  return context.switchToHttp().getRequest().msg;
});
@RabbitSubscribe({
    exchange: '---',
    routingKey: '',
    queue: '---',
  })
  @UseInterceptors(new InboxValidationInterceptor())
  async updateLeadStatus(@ReportMessage() message: {}): Promise<Nack> {
...
}

The decorator ReportMessage is never called, the message object contains all request data and not only msg object.

1reaction
mabuonomocommented, Jan 8, 2021

hi @WonderPanda are there any updates on this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling Long Processes using Nest.JS and RabbitMQ
A article on how I handle long processes using Nest.JS and RabbitMQ. This contains a tutorial on how to implement the consumer and...
Read more >
RabbitMQ - Microservices - A progressive Node.js framework
One method for creating an instance is to use the ClientsModule . To create a client instance with the ClientsModule , import it...
Read more >
RabbitMQ tutorial - Work Queues
A worker process running in the background will pop the tasks and eventually execute the ... They will both get messages from the...
Read more >
Rails: How to listen to / pull from service or queue?
I just set up RabbitMQ messaging within my application and will be implementing for decoupled (multiple, distributed) applications in the next day or...
Read more >
Dead Lettering in Nest.js & RabbitMQ — Is it even possible?
Last week I found myself struggling to find some documentation about dead letter exchanges with Nest.js & RabbitMQ.
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