In per message Compression, clients can enable or disable compression for each message. This function has been added to the FioranoMessage class.
Relevant public methods are listed below:
Message compression is enabled for a message using the default compression level and the default compression strategy.
Message compression is enabled for a message with the required compression level and strategy provided as input parameters.
This is used to retrieve the compression ratio (expressed as a percentage) achieved after the message has been sent. The computation for the ratio is: :
Compression Ratio = ((uncomp – comp)/comp) * 100
'Uncomp' represents the uncompressed message body size and 'comp' represents the compressed message body size.
Depending on this ratio, clients have the option of deciding the optimum compression level and strategy for particular scenarios. This value is available after the send/publish call returns and also after a message is received.
This API is used to set the compression level for a message.
This API is used to set the compression strategy for a message.
This API retrieves the compression level as an integer value.
This API retrieves the compression strategy as an integer value.
Samples illustrating message compression are bundled within FioranoMQ. Please refer to the /MessageCompression/PerMessage directory of the /fmq/samples/PubSub and /fmq/samples/PTP directory of the FioranoMQ installation directory/package. It is recommended that these samples should be run to understand the usage of the APIs.