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§
sourcefn headers(&self) -> Option<&BTreeMap<String, String>>
fn headers(&self) -> Option<&BTreeMap<String, String>>
Return the list of headers to be provided when payload is sent to Kafka.
sourcefn serialize(&self) -> Result<Cow<'_, [u8]>, ClientError>
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.