Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MassTransit Interoperability with non-.NET services

Tags:

masstransit

I have been using MassTransit and really like it. However, by default, it wraps all RabbitMQ payloads/messages with some JSON specific to MassTransit. This makes it difficult to exchange messages with non-.NET services. I know that JSON can be parsed by any language, but MassTransit is a .NET-only thing, and in my non-.NET services, I'd like to avoid having to add special logic to handle messages generated by MassTransit.

Is it possible to serialize JSON messages using MassTransit that don't go through the "MessageEnvelope" interface to establish better interoperability with non-MassTransit services? Or would doing this break most/all the MassTransit functionality?

like image 242
Andy Avatar asked Mar 29 '18 14:03

Andy


1 Answers

It is described in the documentation.

You won't be able to avoid having some special logic to consume MT messages since the format of messages is pre-defined.

This is a minimal message:

{
    "destinationAddress": "rabbitmq://localhost/input_queue",
    "headers": {},
    "message": {
        "value": "Some Value",
        "customerId": 27
    },
    "messageType": [
        "urn:message:MassTransit.Tests:ValueMessage"
    ]
}
like image 132
Alexey Zimarev Avatar answered Nov 15 '22 02:11

Alexey Zimarev