AlariCode / nestjs-rmq

A custom library for NestJS microservice. It allows you to use RabbitMQ or AMQP.
https://purpleschool.ru
MIT License
285 stars 38 forks source link

Add Controller Options & Msg Factory #13

Closed mjarmoc closed 4 years ago

mjarmoc commented 4 years ago

This PR introduces a possibility to add params to RMQController decorator.

The first application is a possibility to provide custom msg factory. We use it to call RMQRoute event handler with two arguments: Payload & Context instead of one (msg). In a custom factory, you may define n parameters and provide custom params decorator for them. This does not conflict with middleware/interceptors since it does not process the msg (and propagation to listeners/emitters) but the way msg is applied to the route handler function in the controller.

AlariCode commented 4 years ago

@mjarmoc, thanks for PR! Can you provide usage example for docs?

mjarmoc commented 4 years ago

Sure, will do it today / tomorrow.

mjarmoc commented 4 years ago

@AlariCode example and explanation provided in docs, please take a look.