pub struct MessageMetadata {
pub timestamp: Option<Duration>,
pub source: Option<String>,
pub partition: Option<u32>,
pub offset: Option<u64>,
pub key: Option<String>,
pub headers: Vec<(String, String)>,
}Expand description
Metadata associated with a message.
Fields§
§timestamp: Option<Duration>When the message was created (as Duration since UNIX_EPOCH).
source: Option<String>The source of the message (e.g., topic, file, etc.).
partition: Option<u32>Partition or shard information.
offset: Option<u64>Offset within the partition/source.
key: Option<String>User-defined key for routing/grouping.
headers: Vec<(String, String)>Additional headers/attributes.
Implementations§
Source§impl MessageMetadata
impl MessageMetadata
Sourcepub fn with_timestamp_now() -> Self
pub fn with_timestamp_now() -> Self
Create metadata with the current timestamp.
Sourcepub fn get_header(&self, name: &str) -> Option<&str>
pub fn get_header(&self, name: &str) -> Option<&str>
Get a header by name.
Trait Implementations§
Source§impl Clone for MessageMetadata
impl Clone for MessageMetadata
Source§fn clone(&self) -> MessageMetadata
fn clone(&self) -> MessageMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessageMetadata
impl Debug for MessageMetadata
Source§impl Default for MessageMetadata
impl Default for MessageMetadata
Source§fn default() -> MessageMetadata
fn default() -> MessageMetadata
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MessageMetadata
impl RefUnwindSafe for MessageMetadata
impl Send for MessageMetadata
impl Sync for MessageMetadata
impl Unpin for MessageMetadata
impl UnwindSafe for MessageMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more