relay_kafka

Trait Message

source
pub trait Message {
    // Required methods
    fn key(&self) -> [u8; 16];
    fn variant(&self) -> &'static str;
    fn headers(&self) -> Option<&BTreeMap<String, String>>;
    fn serialize(&self) -> Result<Cow<'_, [u8]>, ClientError>;
}
Expand description

Describes the type which can be sent using kafka producer provided by this crate.

Required Methods§

source

fn key(&self) -> [u8; 16]

Returns the partitioning key for this kafka message determining.

source

fn variant(&self) -> &'static str

Returns the type of the message.

source

fn headers(&self) -> Option<&BTreeMap<String, String>>

Return the list of headers to be provided when payload is sent to Kafka.

source

fn serialize(&self) -> Result<Cow<'_, [u8]>, ClientError>

Serializes the message into its binary format.

§Errors

Returns the ClientError::InvalidMsgPack or ClientError::InvalidJson if the serialization failed.

Implementors§