Channel compression in IBM MQ classes for JMS
An IBM MQ classes for JMS application can use IBM MQ facilities to compress a message header or data.
Compressing the data that flows on an IBM MQ channel can improve the performance of the channel and reduce network traffic. Using function supplied with IBM MQ, we can compress the data that flows on message channels and MQI channels. 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.
An IBM MQ classes for 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 described. The first code fragment shows you how to implement header data compression:Collection headerComp = new Vector(); headerComp.add(new Integer(WMQConstants.WMQ_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(WMQConstants.WMQ_COMPMSG_RLE)); msgComp.add(new Integer(WMQConstants.WMQ_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. To use compression on a connection, the setHdrCompList() and the setMsgCompList() methods must be called before creating the Connection object. Parent topic: Accessing IBM MQ features from an IBM MQ classes for JMS application