[][src]Trait rdkafka::message::Message

pub trait Message {
    type Headers: Headers;
    fn key(&self) -> Option<&[u8]>;
fn payload(&self) -> Option<&[u8]>;
fn topic(&self) -> &str;
fn partition(&self) -> i32;
fn offset(&self) -> i64;
fn timestamp(&self) -> Timestamp;
fn headers(&self) -> Option<&Self::Headers>; fn payload_view<P: ?Sized + FromBytes>(
        &self
    ) -> Option<Result<&P, P::Error>> { ... }
fn key_view<K: ?Sized + FromBytes>(&self) -> Option<Result<&K, K::Error>> { ... } }

The Message trait provides access to the fields of a generic Kafka message.

Associated Types

type Headers: Headers

Represent the type of headers that this message contains.

Loading content...

Required methods

fn key(&self) -> Option<&[u8]>

Returns the key of the message, or None if there is no key.

fn payload(&self) -> Option<&[u8]>

Returns the payload of the message, or None if there is no payload.

fn topic(&self) -> &str

Returns the source topic of the message.

fn partition(&self) -> i32

Returns the partition number where the message is stored.

fn offset(&self) -> i64

Returns the offset of the message.

fn timestamp(&self) -> Timestamp

Returns the message timestamp for a consumed message if available.

fn headers(&self) -> Option<&Self::Headers>

Returns the headers of the message, if available.

Loading content...

Provided methods

fn payload_view<P: ?Sized + FromBytes>(&self) -> Option<Result<&P, P::Error>>

Converts the raw bytes of the payload to a reference of the specified type, that points to the same data inside the message and without performing any memory allocation

fn key_view<K: ?Sized + FromBytes>(&self) -> Option<Result<&K, K::Error>>

Converts the raw bytes of the key to a reference of the specified type, that points to the same data inside the message and without performing any memory allocation

Loading content...

Implementors

impl Message for OwnedMessage[src]

type Headers = OwnedHeaders

impl<'a> Message for BorrowedMessage<'a>[src]

type Headers = BorrowedHeaders

Loading content...