You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two separate projects – a publisher and a consumer. I’m using MassTransit, and to simplify configuration I’m using the NuGet package CommunityToolkit.Aspire.MassTransit.RabbitMQ.
This indicates that MassTransit automatically creates an exchange and a queue for the message type (PostPlatformMessage) as fanout, even though I configured a topic exchange. As a result, the consumer receives all messages of this type regardless of the routing key.
I want messages to be routed based on the RoutingKey to the correct consumer, so that only messages matching the consumer’s configured routing key are delivered to it, using a topic exchange.
Currently, my consumer receives messages that should be routed to other consumers based on the routing key. Even though I configure the exchange as topic and set routing keys for both publishing and binding, messages seem to be delivered to the consumer regardless of the routing key.
Could someone advise why this might be happening and how to correctly configure MassTransit + Aspire + RabbitMQ to respect routing keys when publishing to a topic exchange?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have two separate projects – a publisher and a consumer. I’m using MassTransit, and to simplify configuration I’m using the NuGet package CommunityToolkit.Aspire.MassTransit.RabbitMQ.
My publisher setup:
My consumer setup:
Consumer:
Consumer definition:
Publishing messages:
When I check RabbitMQ management, I see the following setup:
This indicates that MassTransit automatically creates an exchange and a queue for the message type (PostPlatformMessage) as fanout, even though I configured a topic exchange. As a result, the consumer receives all messages of this type regardless of the routing key.
I want messages to be routed based on the RoutingKey to the correct consumer, so that only messages matching the consumer’s configured routing key are delivered to it, using a topic exchange.
Currently, my consumer receives messages that should be routed to other consumers based on the routing key. Even though I configure the exchange as topic and set routing keys for both publishing and binding, messages seem to be delivered to the consumer regardless of the routing key.
Could someone advise why this might be happening and how to correctly configure MassTransit + Aspire + RabbitMQ to respect routing keys when publishing to a topic exchange?
Beta Was this translation helpful? Give feedback.
All reactions