MassTransit Interoperability with non-.NET services

一个人想着一个人 提交于 2020-01-24 03:03:06

问题


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?


回答1:


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"
    ]
}


来源:https://stackoverflow.com/questions/49558358/masstransit-interoperability-with-non-net-services

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!