Friday, January 19, 2018

MassTransit–No queue is created

Yesterday, I was working on a new project where we planned to use MassTransit. After creating the RabbitMQ configuration and publishing a first message, I noticed that an Exchange was created in RabbitMQ but that it was not bound to a queue. This resulted in the fact that the message was lost Sad smile.

Here is the related code:

In the RabbitMQ administration I saw the following in the list of Exchanges:

image

But when I clicked on the Exchange to view the details, I saw that the exchange was not linked to any queue:

image

As I found out, this is expected behavior in MassTransit.

From StackOverflow:

Publishing a message does not create any queues. Queues are created when receive endpoints are added to a bus. Until the receive endpoints are started, and their topology configured in RabbitMQ (the exchange-exchange-queue bindings), any messages published are not delivered because there are no bindings to any queues. Once the receive endpoints are started, those bindings exist and messages will be delivered to the queues.

No comments: