pub struct TopicProducer { /* private fields */ }
Expand description

An interface for producing events to a particular topic

A TopicProducer allows you to send events to the specific topic it was initialized for. Once you have a TopicProducer, you can send events to the topic, choosing which partition each event should be delivered to.

Implementations

Send all the queued records in the producer batches.

Example
producer.send("Key", "Value").await?;
producer.flush().await?;

Sends a key/value record to this producer’s Topic.

The partition that the record will be sent to is derived from the Key.

Depending on the producer configuration, a send call will not send immediately the record to the SPU. Instead, it could add the record to a batch. TopicProducer::flush is used to immediately send all the queued records in the producer batches.

Example
producer.send("Key", "Value").await?;

Clear partition producers errors in order to make partition producers available. This is needed once an error is present in order to send new records again.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more