Enabling Channel Compression for a Session in the PubSub+ JCSMP API

Valid values for the compression level to be applied to messages published by a PubSub+ JCSMP API client are 0 (no compression), or 1 through 9 (where 1 offers the least amount of compression and fastest data throughput, and 9 offers the most compression and slowest data throughput). The default value is 0. The compression value should be adjusted according to particular network requirements and the performance required.

Solace also offers message payload compression in the PubSub+ Messaging APIs. We recommend you only use one form of compression, either message compression through the event broker or message payload compression through the APIs. Compressing the same message multiple times can waste resources and usually does not result in smaller message sizes. For more information, see Support for End-to-End Payload Compression.

To enable channel compression, use JCSMPChannelProperties.setCompressionLevel(...).

For an example of how to enable channel compression, see the DirectPubSub sample in the Solace Developer Hub.