Struct kafka::consumer::Builder
[−]
[src]
pub struct Builder { // some fields omitted }
A Kafka Consumer builder easing the process of setting up various configuration settings.
Methods
impl Builder
[src]
fn with_partitions(self, partitions: &[i32]) -> Builder
Explicitely specifies the partitions to consume.
If this function is never called, all available partitions of the underlying topic will be consumed assumed.
fn with_fallback_offset(self, fallback_offset_time: FetchOffset) -> Builder
Specifies the offset to use when none was committed for the underlying group yet.
Running the underlying group for the first time against a
topic results in the question where to start reading from the
topic, since it might already contain a lot of messages.
Common strategies are starting at the earliest available
message (thereby consuming whatever is currently in the topic)
or at the latest one (thereby staring to consume only newly
arriving messages.) The parameter here corresponds to time
in KafkaClient::fetch_offsets
.
Unless this method is called and there is no offset committed for the underlying group yet, this consumer will not retrieve any messages from the underlying topic.
fn with_fetch_max_wait_time(self, max_wait_time: i32) -> Builder
See KafkaClient::set_fetch_max_wait_time
fn with_fetch_min_bytes(self, min_bytes: i32) -> Builder
See KafkaClient::set_fetch_min_bytes
fn with_fetch_max_bytes_per_partition(self, max_bytes_per_partition: i32) -> Builder
See KafkaClient::set_fetch_max_bytes_per_partition
fn with_retry_max_bytes_limit(self, limit: i32) -> Builder
Specifies the upper bound of data bytes to allow fetching from a kafka partition when retrying a fetch request due to a too big message in the partition.
By default, this consumer will fetch up to
KafkaClient::fetch_max_bytes_per_partition
data from each
partition. However, when it discovers that there are messages
in an underlying partition which could not be delivered, the
request to that partition might be retried a few times with an
increased fetch_max_bytes_per_partition
. The value
specified here defines a limit to this increment.
A value smaller than the
KafkaClient::fetch_max_bytes_per_partition
, e.g. zero, will
disable the retry feature of this consumer. The default value
for this setting is DEFAULT_RETRY_MAX_BYTES_LIMIT
.
Note: if the consumed topic partitions are known to host large
messages it is much more efficient to set
KafkaClient::fetch_max_bytes_per_partition
appropriately
instead of relying on the limit specified here. This limit is
just an upper bound for already additional retry requests.
fn create(self) -> Result<Consumer>
Finally creates/builds a new consumer based on the so far supplied settings.