Search code examples
xmlmasstransitraw

MassTransit receive a message in Raw or XML format


I am trying to get an XML message from a queue (hosted by ActiveMQ). It works perfectly as long as I use JSON messages, but I do not get it to work with raw text or XML messages.

I have tried to change the ContentType:

cfg.DefaultContentType = new ContentType(@"application/vnd.masstransit+xml");

I also tried to create a custom Deserializer.

I always end up with a deserialization error of the Json Deserializer.


Solution

  • You would need to configure the proper deserializer, such as:

    cfg.UseRawXmlDeserializer()

    (requires the MassTransit.Newtonsoft package)