pub struct Kafka {
pub brokers: Vec<String>,
pub topic: String,
pub message_timeout_ms: u32,
pub delivery_wait_secs: u64,
/* private fields */
}Expand description
Kafka client configuration for audit message production.
The [FutureProducer] is lazily created on the first
call to Audit::produce_message and reused for all
subsequent calls via an internal OnceLock.
Fields§
§brokers: Vec<String>Bootstrap broker list, e.g. vec!["kafka.example.com:9092"].
topic: StringKafka topic that audit messages are published to.
message_timeout_ms: u32librdkafka message.timeout.ms: how long a queued audit
message tries to deliver before being dropped.
delivery_wait_secs: u64How long produce_message blocks waiting for delivery
confirmation. Zero (default) is fire-and-forget.
Implementations§
Source§impl Kafka
impl Kafka
Sourcepub fn new(brokers: Vec<String>, topic: String) -> Self
pub fn new(brokers: Vec<String>, topic: String) -> Self
Create a new Kafka instance with the given broker list and
topic name. Uses the crate-internal message.timeout.ms and
delivery-wait defaults (5000ms and fire-and-forget,
respectively); for non-default values, deserialize a Kafka
from server.toml’s [auditor.kafka] block instead.
The actual FutureProducer is built lazily on the first
Audit::produce_message call, so this constructor is cheap
and infallible.
Trait Implementations§
Source§impl Audit for Kafka
impl Audit for Kafka
Source§async fn produce_message(&self, data: &[u8]) -> Result<(), MantaError>
async fn produce_message(&self, data: &[u8]) -> Result<(), MantaError>
Source§impl<'de> Deserialize<'de> for Kafka
impl<'de> Deserialize<'de> for Kafka
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl !Freeze for Kafka
impl !RefUnwindSafe for Kafka
impl Send for Kafka
impl Sync for Kafka
impl Unpin for Kafka
impl !UnwindSafe for Kafka
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more