Channel compression

 

Compressing the data that flows on a WebSphere MQ channel can improve the performance of the channel and reduce network traffic. Using function supplied with WebSphere MQ, we can compress the data that flows on message channels and MQI channels and, on either type of channel, we can compress header data and message data independently of each other. By default, no data is compressed on a channel. For a full description of channel compression, including how it is implemented in WebSphere MQ, see WebSphere MQ Intercommunication, for message channels, and WebSphere MQ Clients, for MQI channels.

A WebSphere MQ JMS application specifies the techniques that can be used for compressing header or message data on a connection by creating a java.util.Collection object. Each compression technique is an Integer object in the collection, and the order in which the application adds the compression techniques to the collection is the order in which the compression techniques are negotiated with the queue manager when the application creates the connection. The application can then pass the collection to a ConnectionFactory object by calling the setHdrCompList() method, for header data, or the setMsgCompList() method, for message data. When the application is ready, it can create the connection.

The following code fragments illustrate the approach just described. The first code fragment shows you how to implement header data compression:

Collection headerComp = new Vector();
headerComp.add(new Integer(JMSC.MQJMS_COMPHDR_SYSTEM));
.
.
.
((MQConnectionFactory) cf).setHdrCompList(headerComp);
.
.
.
connection = cf.createConnection();
The second code fragment shows you how to implement message data compression:
Collection msgComp = new Vector();
msgComp.add(new Integer(JMSC.MQJMS_COMPMSG_RLE));
msgComp.add(new Integer(JMSC.MQJMS_COMPMSG_ZLIB_HIGH));
.
.
.
((MQConnectionFactory) cf).setMsgCompList(msgComp);
.
.
.
connection = cf.createConnection();
In the second example, the compression techniques are negotiated in the order RLE, then ZLIB_HIGH, when the connection is created. The compression technique that is selected cannot be changed during the lifetime of the Connection object. Note that, to use compression on a connection, the setHdrCompList() and the setMsgCompList() methods must be called before creating the Connection object.

For more information about specifying compression techniques, and about which compression techniques are available, see MQConnectionFactory and JMSC.


uj25050_