Home > OS >  Masstransit consumer raw message
Masstransit consumer raw message

Time:09-16

Someone put a message in RabbitMq (for example). The message is not in the Masstransit "envelop" format, just json, or maybe something else. How to get this message in Masstransit consumer as byte[], or string?

I understand that Masstransit has its own message format, but there is a need to receive a raw message. I don’t really like the option when Masstransit and RabbitMq client are used in one service, because these are already two connections, and different message processing logic.

CodePudding user response:

On the receive endpoint where raw JSON messages are to be consumed, you can configure a default deserializer as shown:

endpointConfigurator.UseRawJsonDeserializer(isDefault: true);
  • Related