How publish a message?
Hello, thanks for this library! I was wondering how it is possible write (i.e. publish) on the message bus. Using the pubSubHandler I can receive the messages, but it is not clear to me how to write messages on an exchange.
Thanks, best wishes Thomas
Hey @bolognesi thanks for your interest in the library. This part of the docs needs to be improved but sending messages is quite simple. Assuming you've included the RabbitMQModule in your application, you can simply inject the AmqpConnection into the controller/service from which you would like to publish messages and interact with the connection directly.
Here's an example from the integration tests of publishing a message:
https://github.com/golevelup/nestjs/blob/7b1a665fa7678575fda40dd9ca85ef6d0dd4d580/integration/rabbitmq/e2e/subscribe.e2e-spec.ts#L58
I'll try and make some much needed improvements to the docs in the coming week. Feel free to re-open if this doesn't get you up and running but I'm going to close this issue for now
@bolognesi
I've added a Table of Contents and new sections to the RabbitMQ docs to explain this better
https://github.com/golevelup/nestjs/tree/master/packages/rabbitmq#sending-messages
@WonderPanda Great job and great library.Thanks!