Trait rdkafka::producer::ProducerContext

source ·
pub trait ProducerContext: ClientContext {
    type DeliveryOpaque: IntoOpaque;

    // Required method
    fn delivery(
        &self,
        delivery_result: &DeliveryResult<'_>,
        delivery_opaque: Self::DeliveryOpaque
    );
}
Expand description

Producer-specific context.

This user-defined object can be used to provide custom callbacks for producer events. Refer to the list of methods to check which callbacks can be specified.

In particular, it can be used to specify the delivery callback that will be called when the acknowledgement for a delivered message is received.

See also the ClientContext trait.

Required Associated Types§

source

type DeliveryOpaque: IntoOpaque

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.

Required Methods§

source

fn delivery( &self, delivery_result: &DeliveryResult<'_>, delivery_opaque: Self::DeliveryOpaque )

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.

Object Safety§

This trait is not object safe.

Implementors§