pub trait Producer: Sync {
// Required method
fn publish(&self, data: &[u8]);
}Expand description
Provides the ability to publish events to a stream.
Required Methods§
Sourcefn publish(&self, data: &[u8])
fn publish(&self, data: &[u8])
Publishes data to the stream.
This method blocks until the data is guaranteed to be persisted and durable. The exact durability semantics depend on the backend—for example, Kafka provides this guarantee by waiting for an acknowledgment.
This method does not return an error and is expected to always succeed. Implementations must handle transient failures internally (e.g., via retries). If persistence becomes impossible, the implementation must panic or abort to prevent the system from continuing without its durability guarantees.