NServiceBus with large XML messages

I read about true messaging and that instead of sending a payload on the bus, it sends an identifier. In our case, we have a lot of outdated applications / services, and they were designed to receive a message payload (xml) that is close to 4 MB (closing the MSMQ limit). Is there a way for the nService bus to handle a large payload and save messages automatically or other work, so that the publisher / subscriber services do not need to worry about the size of the payload or how to de-hydrate the payload? Thank you in advance.

+4
source share
3 answers

I am not aware of any internal NServiceBus function for associating extra data with a message out of range.

I think that you are right at the point - if all the payload cannot fit into the limit, then it is better to save it in another place at your discretion, and then transfer the identifier.

However, you may be able to create a message structure so that the message can implement the IHasPayload interface (which could possibly include an identifier and type?), And then your application logic could have a common method for receiving the payload with the IHasPayload message.

0
source

You can use the Message Sequence template. In NServiceBus, you would share the payload in the sender, wrap the pieces in the custom IMessage "Sequence", and then implement the saga on the other end to extract the pieces and collect them. You will need to make some effort to handle errors and timeouts.

+1
source

You can always use a quick fix for message compression.

POCO serialized using a binary serializer can be compressed by a wide margin. We saw our messages, which were compressed to 20 MB, to 3.1 MB.

So, if your messages fluctuate around 4 mb, it may just be easy to write IMessageSerializer, which automatically compresses the message when it is on the wire.

+1
source

Source: https://habr.com/ru/post/1308770/


All Articles