Trait rdkafka::producer::ProducerContext
source · [−]pub trait ProducerContext: ClientContext {
type DeliveryOpaque: IntoOpaque;
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.
Associated Types
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
fn delivery(
&self,
delivery_result: &DeliveryResult<'_>,
delivery_opaque: Self::DeliveryOpaque
)
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.