Enabling Channel Compression for a Session
Valid values for the compression level to be applied to messages published by a 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.
PubSub+ Messaging API | Use |
---|---|
JCSMP |
JCSMPChannelProperties.setCompressionLevel(...) |
Java RTO |
SessionHandle.PROPERTIES.COMPRESSION_LEVEL |
C |
SOLCLIENT_SESSION_PROP_COMPRESSION_LEVEL |
.NET |
SessionProperties.CompressionLevel |
Node.js |
SessionProperties.CompressionLevel |
JavaScript | Not applicable (compression not supported) |
Related Samples
For an example of how to enable channel compression, refer to the DirectPubSub
sample for the appropriate messaging API.