Skip to main content

RecordProducer

Trait RecordProducer 

Source
pub trait RecordProducer:
    Send
    + Sync
    + 'static {
    // Required methods
    fn send<'life0, 'life1, 'async_trait>(
        &'life0 self,
        topic: &'life1 str,
        partition: Option<i32>,
        key: Option<Bytes>,
        value: Option<Bytes>,
    ) -> Pin<Box<dyn Future<Output = Result<(), StreamsClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn flush<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), StreamsClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn send_with_timestamp<'life0, 'life1, 'async_trait>(
        &'life0 self,
        topic: &'life1 str,
        partition: Option<i32>,
        key: Option<Bytes>,
        value: Option<Bytes>,
        _timestamp_ms: Option<i64>,
    ) -> Pin<Box<dyn Future<Output = Result<(), StreamsClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Methods§

Source

fn send<'life0, 'life1, 'async_trait>( &'life0 self, topic: &'life1 str, partition: Option<i32>, key: Option<Bytes>, value: Option<Bytes>, ) -> Pin<Box<dyn Future<Output = Result<(), StreamsClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Enqueue a record to topic.

partition:

  • None uses the producer’s key-hash partitioner. This is correct for a sink topic or a repartition topic.
  • Some(p) pins the record to partition p. A changelog topic needs this, so that the task restore can read the record back from the task partition.
Source

fn flush<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), StreamsClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Block until the broker acknowledges every enqueued record. This is the durability barrier.

Provided Methods§

Source

fn send_with_timestamp<'life0, 'life1, 'async_trait>( &'life0 self, topic: &'life1 str, partition: Option<i32>, key: Option<Bytes>, value: Option<Bytes>, _timestamp_ms: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<(), StreamsClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Like send, but it sets the record’s timestamp in epoch milliseconds when timestamp_ms is Some.

The default delegates to send, and the producer then fills in the wall-clock time. The broker producer overrides this method, so that a versioned-store changelog record carries the version timestamp (KIP-889).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§