pub struct ConsumerRecordOptionsBuilder<K, V> { /* private fields */ }Expand description
Fluent builder for ConsumerRecordOptions: every parameter has a setter,
and Self::build checks that the mandatory ones were set.
Implementations§
Source§impl<K, V> ConsumerRecordOptionsBuilder<K, V>
impl<K, V> ConsumerRecordOptionsBuilder<K, V>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a builder with every mandatory parameter unset and every other parameter at the value Java passes on the caller’s behalf.
§Returns
The new builder.
Sourcepub fn set_topic(self, topic: impl Into<Arc<str>>) -> Self
pub fn set_topic(self, topic: impl Into<Arc<str>>) -> Self
Sets ConsumerRecordOptions::topic, a mandatory parameter: Self::build
returns an error if it was not set.
§Arguments
topic- The topic this record is received from
§Returns
This builder.
Sourcepub fn set_partition(self, partition: i32) -> Self
pub fn set_partition(self, partition: i32) -> Self
Sets ConsumerRecordOptions::partition, a mandatory parameter: Self::build
returns an error if it was not set.
§Arguments
partition- The partition of the topic this record is received from
§Returns
This builder.
Sourcepub fn set_offset(self, offset: i64) -> Self
pub fn set_offset(self, offset: i64) -> Self
Sets ConsumerRecordOptions::offset, a mandatory parameter: Self::build
returns an error if it was not set.
§Arguments
offset- The offset of this record in the corresponding Kafka partition
§Returns
This builder.
Sourcepub fn set_timestamp(self, timestamp: i64) -> Self
pub fn set_timestamp(self, timestamp: i64) -> Self
Sourcepub fn set_timestamp_type(self, timestamp_type: TimestampType) -> Self
pub fn set_timestamp_type(self, timestamp_type: TimestampType) -> Self
Sourcepub fn set_serialized_key_size(self, serialized_key_size: i32) -> Self
pub fn set_serialized_key_size(self, serialized_key_size: i32) -> Self
Sourcepub fn set_serialized_value_size(self, serialized_value_size: i32) -> Self
pub fn set_serialized_value_size(self, serialized_value_size: i32) -> Self
Sourcepub fn set_key(self, key: Option<K>) -> Self
pub fn set_key(self, key: Option<K>) -> Self
Sets ConsumerRecordOptions::key, a mandatory parameter: Self::build
returns an error if it was not set.
§Arguments
key- The key of the record, if one exists (Noneis allowed)
§Returns
This builder.
Sourcepub fn set_value(self, value: Option<V>) -> Self
pub fn set_value(self, value: Option<V>) -> Self
Sets ConsumerRecordOptions::value, a mandatory parameter: Self::build
returns an error if it was not set.
§Arguments
value- The record contents
§Returns
This builder.