是否可以使用不通过"MessageEnvelope"接口的MassTransit序列化JSON消息,以与非MassTransit服务建立更好的互操作性?还是这样做会破坏大多数/全部的MassTransit功能?解决方案它是中所述的文档.由于消息的格式是预先定义的,因此您将无法避免使用某些特殊逻辑来消耗MT消息.这是一条最小的消息:{ "destinationAddress": "rabbitmq://localhost/input_queue", "headers": {}, "message": { "value": "Some Value", "customerId": 27 }, "messageType": [ "urn:message:MassTransit.Tests:ValueMessage" ]}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? 解决方案 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" ]} 这篇关于与非.NET服务的MassTransit互操作性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-23 10:59