There is an internal message compression pattern implemented in the framework. It uses the .net DeflateStream to compress and de-compress a message via an extension method on the BrokeredMessage class.

Fortunately as a developer you dont really need to worry about how to use it, you would simple use the compressBody attribute on the decleration of your Service Bus Client in the config file and the framework will take care of the rest.

The below shows how you can do this in the configuration.


<add name="RPC-Client-WithCompression" 
         connectionString="ServiceBusConnection" 
         sendToMessagingEntity="test-rpc-requestqueue" 
         responseQueue="test-rpc-sessionresponsequeue"      
         compressBody="true" 
         serializationFormat="Json" />


On the receiver side you also dont need to worry about this. If a client sets the compressBody attribute then the framework will compress the body and add a property to the message indicating that the body is compressed.

On the receiver side if the Compressed property is set then the the framework will de-compress the message body and process it. The framework will also compress the response if your are implementing the RPC pattern and back when the client receives the response message the framework will also handle the decompression.

Last edited Feb 14, 2014 at 9:56 PM by michaelstephenson, version 2

Comments

No comments yet.