RMQ - RabbitMQ C++ Library
Public Member Functions | Static Public Member Functions | List of all members
BloombergLP::rmqa::CompressionTransformer Class Reference

A message transformer that compresses messages using zstd. More...

#include <rmqa_compressiontransformer.h>

Public Member Functions

 CompressionTransformer (bslma::ManagedPtr< rmqp::MessageTransformer > &impl)
 
rmqt::Result< bool > transform (bsl::shared_ptr< bsl::vector< uint8_t > > &data, rmqt::Properties &props)
 
rmqt::Result inverseTransform (bsl::shared_ptr< bsl::vector< uint8_t > > &data, rmqt::Properties &props)
 
bsl::string name () const
 

Static Public Member Functions

static rmqt::Result< rmqp::MessageTransformercreate ()
 

Detailed Description

A message transformer that compresses messages using zstd.

CompressionTransformers are typically bound to Producers and Consumers, to process messages before sending and after receiving them.

Member Function Documentation

◆ create()

rmqt::Result< rmqp::MessageTransformer > BloombergLP::rmqa::CompressionTransformer::create ( )
static

Create an instance of a CompressionTransformer that can be used by a single thread to manage message compression. The function may fail if insufficient memory is available to allocate a compression context.

◆ inverseTransform()

rmqt::Result BloombergLP::rmqa::CompressionTransformer::inverseTransform ( bsl::shared_ptr< bsl::vector< uint8_t > > &  data,
rmqt::Properties props 
)

Decompresses the given data and props in-place, if they were compressed. If the data is not compressed, it will remain unchanged.

Parameters
dataThe data to be compressed
propsThe message properties
Returns
true Returned if the data was successfully decompressed
false Returned if the decompression failed

◆ name()

bsl::string BloombergLP::rmqa::CompressionTransformer::name ( ) const

Returns the header name used by this transformer to indicate that the message has been compressed.

◆ transform()

rmqt::Result< bool > BloombergLP::rmqa::CompressionTransformer::transform ( bsl::shared_ptr< bsl::vector< uint8_t > > &  data,
rmqt::Properties props 
)

Transform the given data and props in-place into compressed form, if possible. The resulting data will never be larger than the original data, and the properties will be updated to indicate that the message has been compressed.

Parameters
dataThe data to be compressed
propsThe message properties
Returns
true Returned if the data was successfully compressed
false Returned if the data is deemed to be not compressible. In this case, the data and properties will remain unchanged
error Returned if the compression failed for any other reason. The data and properties will remain unchanged

The documentation for this class was generated from the following files: