NServiceBus interoperability
A separate RabbitMQ directed-send profile.
Use the NServiceBus JSON serializer when a MyServiceBus endpoint must exchange directed RabbitMQ messages with NServiceBus. Raw JSON remains a neutral payload format with no NServiceBus-specific behavior.
Verified directions
- MyServiceBus C# → NServiceBus
- NServiceBus → MyServiceBus C#
- MyServiceBus Java → NServiceBus
- NServiceBus → MyServiceBus Java
Configure the serializer
In C#, call SetSerializer<NServiceBusJsonMessageSerializer>(). In Java, call setSerializer(NServiceBusJsonMessageSerializer.class). Configure it globally for a dedicated bus or only on the receive endpoint that forms the NServiceBus boundary.
What the profile maps
Outbound messages use PascalCase JSON and carry NServiceBus message identity, enclosed contract type, intent, time sent, conversation, correlation, reply, and related-message headers. Inbound JSON is matched from the enclosed type and bound case-insensitively. Contract annotations can override the local C# or Java type name when both sides need one shared identity.
This is a directed-send compatibility claim. Publish/subscribe, request/response, recoverability, auditing, sagas, and the wider NServiceBus platform are not yet verified.
Runnable peer
The isolated src/AspireApp_NServiceBus stack runs a real NServiceBus service and a MyServiceBus service configured with the NServiceBus profile on their own RabbitMQ resource. Each peer exposes a send endpoint, making both directions easy to exercise without mixing this profile into the general MassTransit sample stack.