Compressing All Messages From a Producer
You can enable message compression on a per-producer basis, automatically compressing every message sent by the producer whose size exceeds a particular value. Note that a value of -1 (the default) disables message compression. The following methods are provided for JMS and C#:
For JMS messaging:
public interface WmMessageProducer {
// Set the compression threshold for this message producer.
public void setCompressionThreshold(int threshold);
// Get the compression threshold for this message producer.
public int getCompressionThreshold();
}
For C# messaging:
public int CompressionThreshold();
{
set;
get;
}
The following are some sample codes showing compression on a per-producer basis:
For JMS messaging:
// Create a queue sender.
QueueSender sender = session.createSender(queue);
// Set the sender’s compression threshold so that every
// message greater than 256 bytes will be compressed.
((WmMessageProducer) sender).setCompressionThreshold(256);
For C# messaging:
// Create a queue sender.
IMessageProducer sender = session.createProducer(queue);
// Set the sender’s compression threshold so that every
// message greater than 256 bytes will be compressed.
sender.CompressionThreshold = 256;