MassTransit/RabbitMQ Send vs Publish and Fault<> question
I have 2 applications, called appA and appB. They respectively have a aQueue and bQueue, that both application have an ReceiveEndpoint. Both application use the same host on RabbitMQ.
appA is sending the command CreateEntityCommand to appB, into the bQueue, with bus.Send method.
In appB, I have a consumer that, consume CreateEntityCommand.
** so far so good **
Question #1 : If my appB consumer successfully create the entity, i'm publishing a EntityCreatedEvent. My EntityCreatedEvent consumer in appA got it right, but the event is also added to bQueue_skipped, why?
Question #2 : Now, if my appB consumer has an exception, my appA has to be notified. A Fault is generated, in the bQueue. I would like my appA to consume the Fault, but the Fault is automatically on bQueue. If I add an ReceiveEndpoint in appA to listed bQueue, I got a lot of dead_letter (skipped queue).
As a rule of thumb, if your messages get to the dead-letter (skipped) queue, it means that there is a binding between the message type exchange and the queue exchange, but your endpoint has no consumer for a given message type.
It usually happens, when you used to have a consumer and then removed it. MassTransit won't remove the binding for you, but it also won't know how to process messages that keep coming.
You can delete the obsolete binding by going to the RMQ management UI doing the following:
- Open the endpoint queue
- Click on bindings, there is only one there, pointing to the endpoint exchange
- Follow the link to open the endpoint exchange and see the bindings to message type exchanges
- There, you can remove those bindings that you no longer need
If you have no messages in the queue, you can also just remove it and MassTransit will create everything for you, from scratch.