I got a producer (third party) publishing messages on ActiveMQ which are basically serialized POCO objects. Currently I consume those using infrastructure provided by https://www.nuget.org/packages/Apache.NMS.ActiveMQ/ with simple plumbing to support strongly typed messages looking almost like
public async void OnMessage(IMessage message)
{
var msgBody = ((ITextMessage)message).Text;
var deserialized = JsonConvert.DeserializeObject<T>(msgBody);
await Handler.Handle(deserialized);
message.Acknowledge();
}
Producer and consumer do not share the binaries with contracts, type T are my own model classes mimicking the POCO used by producer. It is very simplistic but works for basic scenarios.
I tried switching to MassTransit but no matter the consumer config I use it seems like it is unable to handle deserialization of such messages. It fails with exception
Error converting value "ID:{cluster_name}-0f5e525f2f14ad485-38017-1539583126655-8:18:1:1:2" to type 'System.Nullable`1[System.Guid]'. Path ''.
{cluster-name} being the name of ActiveMQ cluster.
I read on http://masstransit-project.com/MassTransit/advanced/interoperability.html that MassTransit requires messages to involve a set of metadata properties. The messages I'm trying to consume don't have such properties as they are coming from third party not having a clue I'm trying to use MassTransit.
Question: Is it possible to handle such messages with MassTransit? I cannot force the publisher to adjust message schema.