pub struct FutureProducerContext<C: ClientContext + 'static> { /* private fields */ }
Expand description
The ProducerContext
used by the FutureProducer
.
This context will use a Future
as its DeliveryOpaque
and will complete
the future when the message is delivered (or failed to).
Trait Implementations§
Source§impl<C: ClientContext + 'static> ClientContext for FutureProducerContext<C>
impl<C: ClientContext + 'static> ClientContext for FutureProducerContext<C>
Source§fn enable_refresh_oauth_token(&self) -> bool
fn enable_refresh_oauth_token(&self) -> bool
Whether to periodically refresh the SASL
OAUTHBEARER
token
by calling ClientContext::generate_oauth_token
. Read moreSource§fn log(&self, level: RDKafkaLogLevel, fac: &str, log_message: &str)
fn log(&self, level: RDKafkaLogLevel, fac: &str, log_message: &str)
Receives log lines from librdkafka. Read more
Source§fn stats(&self, statistics: Statistics)
fn stats(&self, statistics: Statistics)
Receives the decoded statistics of the librdkafka client. To enable, the
statistics.interval.ms
configuration parameter must be specified. Read moreSource§fn stats_raw(&self, statistics: &[u8])
fn stats_raw(&self, statistics: &[u8])
Receives the JSON-encoded statistics of the librdkafka client. To
enable, the
statistics.interval.ms
configuration parameter must be
specified. Read moreSource§fn error(&self, error: KafkaError, reason: &str)
fn error(&self, error: KafkaError, reason: &str)
Receives global errors from the librdkafka client. Read more
Source§fn rewrite_broker_addr(&self, addr: BrokerAddr) -> BrokerAddr
fn rewrite_broker_addr(&self, addr: BrokerAddr) -> BrokerAddr
Rewrites a broker address for DNS resolution. Read more
Source§fn generate_oauth_token(
&self,
oauthbearer_config: Option<&str>,
) -> Result<OAuthToken, Box<dyn Error>>
fn generate_oauth_token( &self, oauthbearer_config: Option<&str>, ) -> Result<OAuthToken, Box<dyn Error>>
Generates an OAuth token from the provided configuration. Read more
Source§impl<C: Clone + ClientContext + 'static> Clone for FutureProducerContext<C>
impl<C: Clone + ClientContext + 'static> Clone for FutureProducerContext<C>
Source§fn clone(&self) -> FutureProducerContext<C>
fn clone(&self) -> FutureProducerContext<C>
Returns a copy 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<C, R, Part> Producer<FutureProducerContext<C>, Part> for FutureProducer<C, R, Part>
impl<C, R, Part> Producer<FutureProducerContext<C>, Part> for FutureProducer<C, R, Part>
Source§fn client(&self) -> &Client<FutureProducerContext<C>>
fn client(&self) -> &Client<FutureProducerContext<C>>
Returns the
Client
underlying this producer.Source§fn flush<'life0, 'async_trait, T>(
&'life0 self,
timeout: T,
) -> Pin<Box<dyn Future<Output = KafkaResult<()>> + Send + 'async_trait>>
fn flush<'life0, 'async_trait, T>( &'life0 self, timeout: T, ) -> Pin<Box<dyn Future<Output = KafkaResult<()>> + Send + 'async_trait>>
Flushes any pending messages. Read more
Source§fn purge(&self, flags: PurgeConfig)
fn purge(&self, flags: PurgeConfig)
Purge messages currently handled by the producer instance. Read more
Source§fn in_flight_count(&self) -> i32
fn in_flight_count(&self) -> i32
Returns the number of messages that are either waiting to be sent or are
sent but are waiting to be acknowledged.
Source§fn init_transactions<'life0, 'async_trait, T>(
&'life0 self,
timeout: T,
) -> Pin<Box<dyn Future<Output = KafkaResult<()>> + Send + 'async_trait>>
fn init_transactions<'life0, 'async_trait, T>( &'life0 self, timeout: T, ) -> Pin<Box<dyn Future<Output = KafkaResult<()>> + Send + 'async_trait>>
Enable sending transactions with this producer. Read more
Source§fn begin_transaction(&self) -> KafkaResult<()>
fn begin_transaction(&self) -> KafkaResult<()>
Begins a new transaction. Read more
Source§fn send_offsets_to_transaction<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
offsets: &'life1 TopicPartitionList,
cgm: &'life2 ConsumerGroupMetadata,
timeout: T,
) -> Pin<Box<dyn Future<Output = KafkaResult<()>> + Send + 'async_trait>>
fn send_offsets_to_transaction<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, offsets: &'life1 TopicPartitionList, cgm: &'life2 ConsumerGroupMetadata, timeout: T, ) -> Pin<Box<dyn Future<Output = KafkaResult<()>> + Send + 'async_trait>>
Associates an offset commit operation with this transaction. Read more
Source§fn commit_transaction<'life0, 'async_trait, T>(
&'life0 self,
timeout: T,
) -> Pin<Box<dyn Future<Output = KafkaResult<()>> + Send + 'async_trait>>
fn commit_transaction<'life0, 'async_trait, T>( &'life0 self, timeout: T, ) -> Pin<Box<dyn Future<Output = KafkaResult<()>> + Send + 'async_trait>>
Commits the current transaction. Read more
Source§fn abort_transaction<'life0, 'async_trait, T>(
&'life0 self,
timeout: T,
) -> Pin<Box<dyn Future<Output = KafkaResult<()>> + Send + 'async_trait>>
fn abort_transaction<'life0, 'async_trait, T>( &'life0 self, timeout: T, ) -> Pin<Box<dyn Future<Output = KafkaResult<()>> + Send + 'async_trait>>
Aborts the current transaction. Read more
Source§fn context(&self) -> &Arc<C>
fn context(&self) -> &Arc<C>
Returns a reference to the
ProducerContext
used to create this
producer.Source§impl<C, Part> ProducerContext<Part> for FutureProducerContext<C>where
C: ClientContext + 'static,
Part: Partitioner,
impl<C, Part> ProducerContext<Part> for FutureProducerContext<C>where
C: ClientContext + 'static,
Part: Partitioner,
Source§type DeliveryOpaque = Box<Sender<Result<(i32, i64), (KafkaError, OwnedMessage)>>>
type DeliveryOpaque = Box<Sender<Result<(i32, i64), (KafkaError, OwnedMessage)>>>
A
DeliveryOpaque
is a user-defined structure that will be passed to
the producer when producing a message, and returned to the delivery
method once the message has been delivered, or failed to.Source§fn delivery(
&self,
delivery_result: &DeliveryResult<'_>,
tx: Box<Sender<OwnedDeliveryResult>>,
)
fn delivery( &self, delivery_result: &DeliveryResult<'_>, tx: Box<Sender<OwnedDeliveryResult>>, )
This method will be called once the message has been delivered (or
failed to). The
DeliveryOpaque
will be the one provided by the user
when calling send.Auto Trait Implementations§
impl<C> Freeze for FutureProducerContext<C>where
C: Freeze,
impl<C> RefUnwindSafe for FutureProducerContext<C>where
C: RefUnwindSafe,
impl<C> Send for FutureProducerContext<C>
impl<C> Sync for FutureProducerContext<C>
impl<C> Unpin for FutureProducerContext<C>where
C: Unpin,
impl<C> UnwindSafe for FutureProducerContext<C>where
C: UnwindSafe,
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