I have a single endpoint which handles incoming messages (from a Bus.Send), does some work and then publishes another message. Is it possible to configure it to deserialize incoming messages using the Json serializer, but when publishing, serialize the outgoing message using the Xml serializer?
My config currently looks like below which uses the Json serializer for both deserializing incoming and serializing outgoing messages:
Configure.With()
.DefaultBuilder()
.JsonSerializer()
.MsmqTransport()
.IsTransactional(true)
.PurgeOnStartup(false)
.UnicastBus()
UPDATE
Basic support for this scenario was added with version 5 of NServiceBus and has been made quite a bit more complete in version 6.
Here's some more info on the topic:
https://particular.net/blog/build-a-babel-fish-nservicebus
OLD RESPONSE: This is something that we on the NServiceBus team have been thinking about for some time now. It does make sense to use one serialization format within one system and to do pub/sub communication with other systems using a different serialization format.
I'm afraid that we haven't gotten around to implementing it yet so you're currently stuck with choosing just one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With