MassTransit: How can we configure Multiple bus (Both Rabbit mq)

I have a requirement where I need to read message from one rabbit mq and publish it to another. I tried configuring both the host, but when i publish it publishes only to the first configured rabbit mq.

1 answer

  • answered 2020-10-28 13:40 Alexey Zimarev

    It's called MultiBus and thoroughly described in the documentation.

    In addition, it doesn't "publish to the first configured bus". It only does that if you use a DI container and use the resolved IPublishEndpointProvider. Since it's registered as a singleton with Try, you won't get the second instance registered.

    If you don't use the DI container and use the bus instance, you can do whatever you want. The MultiBus feature allows you to use multiple bus instances registered in the container.