简体   繁体   中英

How to interop with Azure Service Bus topics created by MassTransit using Rebus?

I have an existing system that publishes messages via MassTransit to some Azure Service Bus topic named CompanyName.SystemName.Messages.SomethingGotUpdated . How can I configure a new system, using Rebus, to be a subscriber to that particular topic, then route all the messages to the appropriate IHandleMessages<SomethingGotUpdated> handler?

I looked at the documentation but couldn't really figure out how to accomplish this. Any help is greatly appreciated!

You should do it by creating a MassTransit-based receiver, that receives the messages from the given topic, and then forwards the messages (by using Rebus' one-way client ) to your Rebus endpoint(s).

The reason why you should do it like this, is that MassTransit and Rebus are most likely using Azure Service Bus in slightly different ways, and with very different headers on the messages, meaning that the two service buses will not be readily wire-compatible.

Some people might feel an urge to somehow map their way out of problems like this, probably by inserting a step into the incoming messages pipeline that maps MassTransit headers to Rebus headers, but I fear that you will not even have your step executed because Rebus requires a specific message ID header to be present, otherwise it will immediately move the message to the error queue.

My suggestion is to consider your MassTransit-based system thing of its own, as if it was using a completely separate network for communicating, and then consider your Rebus-based parts a system of its own too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM