Skip to main content

ConsumerRecordOptionsBuilder

Struct ConsumerRecordOptionsBuilder 

Source
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>

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn set_timestamp(self, timestamp: i64) -> Self

Sets ConsumerRecordOptions::timestamp.

§Arguments
  • timestamp - The timestamp of the record.
§Returns

This builder.

Source

pub fn set_timestamp_type(self, timestamp_type: TimestampType) -> Self

Sets ConsumerRecordOptions::timestamp_type.

§Arguments
  • timestamp_type - The timestamp type
§Returns

This builder.

Source

pub fn set_serialized_key_size(self, serialized_key_size: i32) -> Self

Sets ConsumerRecordOptions::serialized_key_size.

§Arguments
  • serialized_key_size - The length of the serialized key
§Returns

This builder.

Source

pub fn set_serialized_value_size(self, serialized_value_size: i32) -> Self

Sets ConsumerRecordOptions::serialized_value_size.

§Arguments
  • serialized_value_size - The length of the serialized value
§Returns

This builder.

Source

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 (None is allowed)
§Returns

This builder.

Source

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.

Source

pub fn set_headers(self, headers: RecordHeaders) -> Self

Sets ConsumerRecordOptions::headers.

§Arguments
  • headers - The headers of the record
§Returns

This builder.

Source

pub fn set_leader_epoch(self, leader_epoch: Option<i32>) -> Self

Sets ConsumerRecordOptions::leader_epoch.

§Arguments
  • leader_epoch - Optional leader epoch of the record (may be empty for legacy record formats)
§Returns

This builder.

Source

pub fn set_delivery_count(self, delivery_count: Option<i16>) -> Self

Sets ConsumerRecordOptions::delivery_count.

§Arguments
  • delivery_count - Optional delivery count of the record (may be empty when deliveries not counted)
§Returns

This builder.

Source

pub fn build(self) -> Result<ConsumerRecordOptions<K, V>, Error>

Returns the built options.

§Errors
  • Error::is_local_illegal_argument_error naming the first of topic, partition, offset, key and value that was not set.

Trait Implementations§

Source§

impl<K: Debug, V: Debug> Debug for ConsumerRecordOptionsBuilder<K, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K, V> Default for ConsumerRecordOptionsBuilder<K, V>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<K, V> Freeze for ConsumerRecordOptionsBuilder<K, V>
where K: Freeze, V: Freeze,

§

impl<K, V> RefUnwindSafe for ConsumerRecordOptionsBuilder<K, V>

§

impl<K, V> Send for ConsumerRecordOptionsBuilder<K, V>
where K: Send, V: Send,

§

impl<K, V> Sync for ConsumerRecordOptionsBuilder<K, V>
where K: Sync, V: Sync,

§

impl<K, V> Unpin for ConsumerRecordOptionsBuilder<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> UnsafeUnpin for ConsumerRecordOptionsBuilder<K, V>
where K: UnsafeUnpin, V: UnsafeUnpin,

§

impl<K, V> UnwindSafe for ConsumerRecordOptionsBuilder<K, V>
where K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V