pub struct ConsumerConfig { /* private fields */ }Expand description
The consumer configuration keys
Implementations§
Source§impl ConsumerConfig
impl ConsumerConfig
Sourcepub const GROUP_ID_CONFIG: &'static str = "group.id"
pub const GROUP_ID_CONFIG: &'static str = "group.id"
Config key: group.id.
Sourcepub const GROUP_INSTANCE_ID_CONFIG: &'static str = "group.instance.id"
pub const GROUP_INSTANCE_ID_CONFIG: &'static str = "group.instance.id"
Config key: group.instance.id.
Sourcepub const GROUP_PROTOCOL_CONFIG: &'static str = "group.protocol"
pub const GROUP_PROTOCOL_CONFIG: &'static str = "group.protocol"
Config key: group.protocol.
Sourcepub const DEFAULT_GROUP_PROTOCOL: &'static str = "classic"
pub const DEFAULT_GROUP_PROTOCOL: &'static str = "classic"
Default value of group.protocol. Matches Java’s DEFAULT_GROUP_PROTOCOL.
Sourcepub const GROUP_REMOTE_ASSIGNOR_CONFIG: &'static str = "group.remote.assignor"
pub const GROUP_REMOTE_ASSIGNOR_CONFIG: &'static str = "group.remote.assignor"
Config key: group.remote.assignor.
Sourcepub const MAX_POLL_RECORDS_CONFIG: &'static str = "max.poll.records"
pub const MAX_POLL_RECORDS_CONFIG: &'static str = "max.poll.records"
Config key: max.poll.records.
Sourcepub const DEFAULT_MAX_POLL_RECORDS: i32 = 500
pub const DEFAULT_MAX_POLL_RECORDS: i32 = 500
Default value of max.poll.records.
Sourcepub const MAX_POLL_INTERVAL_MS_CONFIG: &'static str = "max.poll.interval.ms"
pub const MAX_POLL_INTERVAL_MS_CONFIG: &'static str = "max.poll.interval.ms"
Config key: max.poll.interval.ms.
Sourcepub const SESSION_TIMEOUT_MS_CONFIG: &'static str = "session.timeout.ms"
pub const SESSION_TIMEOUT_MS_CONFIG: &'static str = "session.timeout.ms"
Config key: session.timeout.ms.
Sourcepub const HEARTBEAT_INTERVAL_MS_CONFIG: &'static str = "heartbeat.interval.ms"
pub const HEARTBEAT_INTERVAL_MS_CONFIG: &'static str = "heartbeat.interval.ms"
Config key: heartbeat.interval.ms.
Sourcepub const BOOTSTRAP_SERVERS_CONFIG: &'static str = "bootstrap.servers"
pub const BOOTSTRAP_SERVERS_CONFIG: &'static str = "bootstrap.servers"
Config key: bootstrap.servers.
Sourcepub const CLIENT_DNS_LOOKUP_CONFIG: &'static str = CommonClientConfigs::CLIENT_DNS_LOOKUP_CONFIG
pub const CLIENT_DNS_LOOKUP_CONFIG: &'static str = CommonClientConfigs::CLIENT_DNS_LOOKUP_CONFIG
Config key: client.dns.lookup. Java’s ConsumerConfig declares it as its
own public alias of CommonClientConfigs.CLIENT_DNS_LOOKUP_CONFIG.
Sourcepub const CLIENT_ID_CONFIG: &'static str = "client.id"
pub const CLIENT_ID_CONFIG: &'static str = "client.id"
Config key: client.id.
Sourcepub const CLIENT_RACK_CONFIG: &'static str = crate::CommonClientConfigs::CLIENT_RACK_CONFIG
pub const CLIENT_RACK_CONFIG: &'static str = crate::CommonClientConfigs::CLIENT_RACK_CONFIG
Config key: client.rack.
Sourcepub const DEFAULT_CLIENT_RACK: &'static str = crate::CommonClientConfigs::DEFAULT_CLIENT_RACK
pub const DEFAULT_CLIENT_RACK: &'static str = crate::CommonClientConfigs::DEFAULT_CLIENT_RACK
Default value of client.rack: no rack.
Sourcepub const ENABLE_AUTO_COMMIT_CONFIG: &'static str = "enable.auto.commit"
pub const ENABLE_AUTO_COMMIT_CONFIG: &'static str = "enable.auto.commit"
Config key: enable.auto.commit.
Sourcepub const AUTO_COMMIT_INTERVAL_MS_CONFIG: &'static str = "auto.commit.interval.ms"
pub const AUTO_COMMIT_INTERVAL_MS_CONFIG: &'static str = "auto.commit.interval.ms"
Config key: auto.commit.interval.ms.
Sourcepub const PARTITION_ASSIGNMENT_STRATEGY_CONFIG: &'static str = "partition.assignment.strategy"
pub const PARTITION_ASSIGNMENT_STRATEGY_CONFIG: &'static str = "partition.assignment.strategy"
Config key: partition.assignment.strategy.
Sourcepub const AUTO_OFFSET_RESET_CONFIG: &'static str = "auto.offset.reset"
pub const AUTO_OFFSET_RESET_CONFIG: &'static str = "auto.offset.reset"
Config key: auto.offset.reset.
What to do when there is no initial offset in Kafka or if the current offset does not exist any more on the server (e.g. because that data has been deleted):
earliest: automatically reset the offset to the earliest offsetlatest: automatically reset the offset to the latest offsetby_duration:<duration>: automatically reset the offset to a configured<duration>from the current timestamp.<duration>must be specified in ISO8601 format (PnDTnHnMn.nS). Negative duration is not allowed.none: return an error to the consumer if no previous offset is found for the consumer’s group- anything else: return an error to the consumer.
Note that increasing a topic’s partition count while this config is set
to latest may cause silent message loss: producers may begin appending
records to a newly created partition before the consumer discovers it,
and latest resets the position to the log end offset, skipping any
records produced during that discovery gap.
To avoid this, prefer by_duration:<duration>. When a partition has no
committed offset, by_duration determines the starting position by
issuing a ListOffsets lookup for now() - duration. If the target
timestamp is earlier than the partition’s creation time, the lookup
returns the partition’s start offset, ensuring that records produced
during the discovery window are still consumed. Size the duration to
cover the worst-case partition-discovery latency for the group protocol
in use:
- With the
consumergroup protocol (KIP-848), newly assigned partitions are pushed on the next group heartbeat, so a value at least as large asgroup.consumer.heartbeat.interval.ms(server default 5000 ms) is sufficient, for exampleby_duration:PT5S. - With the
classicgroup protocol, new partitions are discovered through periodic metadata refresh and a subsequent rebalance, so the duration must exceedmetadata.max.age.ms(client default 300000 ms) plus the rebalance time, for exampleby_duration:PT6M.
Consumers with a valid committed offset are unaffected. The reset
applies only to partitions whose offset is missing or out of range, so
by_duration does not force existing consumers to replay historical
data on restart.
(Text of Java’s ConsumerConfig.AUTO_OFFSET_RESET_DOC,
as rewritten by KAFKA-20539. This client
implements only the consumer group protocol; the classic item is kept
because the setting itself is protocol-independent.)
Sourcepub const FETCH_MIN_BYTES_CONFIG: &'static str = "fetch.min.bytes"
pub const FETCH_MIN_BYTES_CONFIG: &'static str = "fetch.min.bytes"
Config key: fetch.min.bytes.
Sourcepub const DEFAULT_FETCH_MIN_BYTES: i32 = 1
pub const DEFAULT_FETCH_MIN_BYTES: i32 = 1
Default value of fetch.min.bytes.
Sourcepub const FETCH_MAX_BYTES_CONFIG: &'static str = "fetch.max.bytes"
pub const FETCH_MAX_BYTES_CONFIG: &'static str = "fetch.max.bytes"
Config key: fetch.max.bytes.
Sourcepub const DEFAULT_FETCH_MAX_BYTES: i32
pub const DEFAULT_FETCH_MAX_BYTES: i32
Default value of fetch.max.bytes.
Sourcepub const FETCH_MAX_WAIT_MS_CONFIG: &'static str = "fetch.max.wait.ms"
pub const FETCH_MAX_WAIT_MS_CONFIG: &'static str = "fetch.max.wait.ms"
Config key: fetch.max.wait.ms.
Sourcepub const DEFAULT_FETCH_MAX_WAIT_MS: i32 = 500
pub const DEFAULT_FETCH_MAX_WAIT_MS: i32 = 500
Default value of fetch.max.wait.ms.
Sourcepub const MAX_PARTITION_FETCH_BYTES_CONFIG: &'static str = "max.partition.fetch.bytes"
pub const MAX_PARTITION_FETCH_BYTES_CONFIG: &'static str = "max.partition.fetch.bytes"
Config key: max.partition.fetch.bytes.
Sourcepub const DEFAULT_MAX_PARTITION_FETCH_BYTES: i32
pub const DEFAULT_MAX_PARTITION_FETCH_BYTES: i32
Default value of max.partition.fetch.bytes.
Sourcepub const CHECK_CRCS_CONFIG: &'static str = "check.crcs"
pub const CHECK_CRCS_CONFIG: &'static str = "check.crcs"
Config key: check.crcs.
Sourcepub const SEND_BUFFER_CONFIG: &'static str = "send.buffer.bytes"
pub const SEND_BUFFER_CONFIG: &'static str = "send.buffer.bytes"
Config key: send.buffer.bytes.
Sourcepub const RECEIVE_BUFFER_CONFIG: &'static str = "receive.buffer.bytes"
pub const RECEIVE_BUFFER_CONFIG: &'static str = "receive.buffer.bytes"
Config key: receive.buffer.bytes.
Sourcepub const SOCKET_CONNECTION_SETUP_TIMEOUT_MS_CONFIG: &'static str = "socket.connection.setup.timeout.ms"
pub const SOCKET_CONNECTION_SETUP_TIMEOUT_MS_CONFIG: &'static str = "socket.connection.setup.timeout.ms"
Config key: socket.connection.setup.timeout.ms.
Sourcepub const SOCKET_CONNECTION_SETUP_TIMEOUT_MAX_MS_CONFIG: &'static str = "socket.connection.setup.timeout.max.ms"
pub const SOCKET_CONNECTION_SETUP_TIMEOUT_MAX_MS_CONFIG: &'static str = "socket.connection.setup.timeout.max.ms"
Config key: socket.connection.setup.timeout.max.ms.
Sourcepub const CONNECTIONS_MAX_IDLE_MS_CONFIG: &'static str = "connections.max.idle.ms"
pub const CONNECTIONS_MAX_IDLE_MS_CONFIG: &'static str = "connections.max.idle.ms"
Config key: connections.max.idle.ms.
Sourcepub const RECONNECT_BACKOFF_MS_CONFIG: &'static str = "reconnect.backoff.ms"
pub const RECONNECT_BACKOFF_MS_CONFIG: &'static str = "reconnect.backoff.ms"
Config key: reconnect.backoff.ms.
Sourcepub const RECONNECT_BACKOFF_MAX_MS_CONFIG: &'static str = "reconnect.backoff.max.ms"
pub const RECONNECT_BACKOFF_MAX_MS_CONFIG: &'static str = "reconnect.backoff.max.ms"
Config key: reconnect.backoff.max.ms.
Sourcepub const RETRY_BACKOFF_MS_CONFIG: &'static str = "retry.backoff.ms"
pub const RETRY_BACKOFF_MS_CONFIG: &'static str = "retry.backoff.ms"
Config key: retry.backoff.ms.
Sourcepub const RETRY_BACKOFF_MAX_MS_CONFIG: &'static str = "retry.backoff.max.ms"
pub const RETRY_BACKOFF_MAX_MS_CONFIG: &'static str = "retry.backoff.max.ms"
Config key: retry.backoff.max.ms.
Sourcepub const BOOTSTRAP_RESOLVE_TIMEOUT_MS_CONFIG: &'static str = CommonClientConfigs::BOOTSTRAP_RESOLVE_TIMEOUT_MS_CONFIG
pub const BOOTSTRAP_RESOLVE_TIMEOUT_MS_CONFIG: &'static str = CommonClientConfigs::BOOTSTRAP_RESOLVE_TIMEOUT_MS_CONFIG
Config key: bootstrap.resolve.timeout.ms (KIP-909): selects the
client’s bootstrap DNS resolution mode. 0 (the default) resolves
bootstrap.servers synchronously when the consumer is created, and a
resolution failure fails creation with a config error. A positive value
resolves asynchronously, retrying for at most this long before every
subsequent call fails with an unrecoverable
BootstrapResolutionError;
the consumer must then be closed and re-created. Setting a positive
value enables an evolving feature whose compatibility may be broken in a
minor release.
Sourcepub const REQUEST_TIMEOUT_MS_CONFIG: &'static str = "request.timeout.ms"
pub const REQUEST_TIMEOUT_MS_CONFIG: &'static str = "request.timeout.ms"
Config key: request.timeout.ms.
Sourcepub const DEFAULT_API_TIMEOUT_MS_CONFIG: &'static str = "default.api.timeout.ms"
pub const DEFAULT_API_TIMEOUT_MS_CONFIG: &'static str = "default.api.timeout.ms"
Config key: default.api.timeout.ms.
Sourcepub const METADATA_MAX_AGE_CONFIG: &'static str = "metadata.max.age.ms"
pub const METADATA_MAX_AGE_CONFIG: &'static str = "metadata.max.age.ms"
Config key: metadata.max.age.ms.
Sourcepub const EXCLUDE_INTERNAL_TOPICS_CONFIG: &'static str = "exclude.internal.topics"
pub const EXCLUDE_INTERNAL_TOPICS_CONFIG: &'static str = "exclude.internal.topics"
Config key: exclude.internal.topics.
Sourcepub const DEFAULT_EXCLUDE_INTERNAL_TOPICS: bool = true
pub const DEFAULT_EXCLUDE_INTERNAL_TOPICS: bool = true
Default value of exclude.internal.topics.
Sourcepub const ISOLATION_LEVEL_CONFIG: &'static str = "isolation.level"
pub const ISOLATION_LEVEL_CONFIG: &'static str = "isolation.level"
Config key: isolation.level.
Sourcepub const DEFAULT_ISOLATION_LEVEL: &'static str = "read_committed"
pub const DEFAULT_ISOLATION_LEVEL: &'static str = "read_committed"
Default for isolation.level: read_committed, so a consumer returns
only the transactional records that were committed.
WARNING: Java’s default is read_uncommitted. read_committed is
librdkafka’s default, which users of the other Confluent clients
expect. Set isolation.level=read_uncommitted for Java’s behaviour.
Sourcepub const ALLOW_AUTO_CREATE_TOPICS_CONFIG: &'static str = "allow.auto.create.topics"
pub const ALLOW_AUTO_CREATE_TOPICS_CONFIG: &'static str = "allow.auto.create.topics"
Config key: allow.auto.create.topics.
Sourcepub const DEFAULT_ALLOW_AUTO_CREATE_TOPICS: bool = true
pub const DEFAULT_ALLOW_AUTO_CREATE_TOPICS: bool = true
Default value of allow.auto.create.topics.
Sourcepub const METRICS_SAMPLE_WINDOW_MS_CONFIG: &'static str = "metrics.sample.window.ms"
pub const METRICS_SAMPLE_WINDOW_MS_CONFIG: &'static str = "metrics.sample.window.ms"
Config key: metrics.sample.window.ms.
Sourcepub const METRICS_NUM_SAMPLES_CONFIG: &'static str = "metrics.num.samples"
pub const METRICS_NUM_SAMPLES_CONFIG: &'static str = "metrics.num.samples"
Config key: metrics.num.samples.
Sourcepub const METRICS_RECORDING_LEVEL_CONFIG: &'static str = "metrics.recording.level"
pub const METRICS_RECORDING_LEVEL_CONFIG: &'static str = "metrics.recording.level"
Config key: metrics.recording.level.
Sourcepub const SHARE_ACKNOWLEDGEMENT_MODE_CONFIG: &'static str = "share.acknowledgement.mode"
pub const SHARE_ACKNOWLEDGEMENT_MODE_CONFIG: &'static str = "share.acknowledgement.mode"
Config key: share.acknowledgement.mode.
Sourcepub const SHARE_ACQUIRE_MODE_CONFIG: &'static str = "share.acquire.mode"
pub const SHARE_ACQUIRE_MODE_CONFIG: &'static str = "share.acquire.mode"
Config key: share.acquire.mode.
Sourcepub fn new(props: &HashMap<String, String>) -> Result<Self, Error>
pub fn new(props: &HashMap<String, String>) -> Result<Self, Error>
Constructs a new ConsumerConfig with the given properties.
§Arguments
props- The consumer configuration properties
§Errors
Error::is_config_errorif a value is invalid, the settings conflict, orsasl.mechanismis notPLAINunder a SASLsecurity.protocol.Error::is_invalid_configuration_errorifenable.auto.commitistruewithout agroup.id.
§Translation notes
WARNING: sasl.mechanism must be PLAIN.
Sourcepub fn get_short(&self, key: &str) -> Result<Option<i16>, Error>
pub fn get_short(&self, key: &str) -> Result<Option<i16>, Error>
The SHORT configuration key. Reading a key marks it used
(Self::unused).
§Arguments
key- the configuration name
§Returns
The value, None for Java’s null.
§Errors
Error::is_config_errorwith Java’sUnknown configuration '<key>'ifkeyis not a configuration this class defines.Error::is_local_illegal_argument_errorifkeyis a configuration of another type, where Java’s cast fails with aClassCastException.
Sourcepub fn get_int(&self, key: &str) -> Result<Option<i32>, Error>
pub fn get_int(&self, key: &str) -> Result<Option<i32>, Error>
The INT configuration key. Reading a key marks it used
(Self::unused).
§Arguments
key- the configuration name
§Returns
The value, None for Java’s null.
§Errors
Error::is_config_errorwith Java’sUnknown configuration '<key>'ifkeyis not a configuration this class defines.Error::is_local_illegal_argument_errorifkeyis a configuration of another type, where Java’s cast fails with aClassCastException.
Sourcepub fn get_long(&self, key: &str) -> Result<Option<i64>, Error>
pub fn get_long(&self, key: &str) -> Result<Option<i64>, Error>
The LONG configuration key. Reading a key marks it used
(Self::unused).
§Arguments
key- the configuration name
§Returns
The value, None for Java’s null.
§Errors
Error::is_config_errorwith Java’sUnknown configuration '<key>'ifkeyis not a configuration this class defines.Error::is_local_illegal_argument_errorifkeyis a configuration of another type, where Java’s cast fails with aClassCastException.
Sourcepub fn get_double(&self, key: &str) -> Result<Option<f64>, Error>
pub fn get_double(&self, key: &str) -> Result<Option<f64>, Error>
The DOUBLE configuration key. Reading a key marks it used
(Self::unused).
§Arguments
key- the configuration name
§Returns
The value, None for Java’s null.
§Errors
Error::is_config_errorwith Java’sUnknown configuration '<key>'ifkeyis not a configuration this class defines.Error::is_local_illegal_argument_errorifkeyis a configuration of another type, where Java’s cast fails with aClassCastException.
Sourcepub fn get_list(&self, key: &str) -> Result<Option<&[String]>, Error>
pub fn get_list(&self, key: &str) -> Result<Option<&[String]>, Error>
The LIST configuration key, borrowed from the parsed values.
Reading a key marks it used (Self::unused).
§Arguments
key- the configuration name
§Returns
The value, None for Java’s null.
§Errors
Error::is_config_errorwith Java’sUnknown configuration '<key>'ifkeyis not a configuration this class defines.Error::is_local_illegal_argument_errorifkeyis a configuration of another type, where Java’s cast fails with aClassCastException.
Sourcepub fn get_boolean(&self, key: &str) -> Result<Option<bool>, Error>
pub fn get_boolean(&self, key: &str) -> Result<Option<bool>, Error>
The BOOLEAN configuration key. Reading a key marks it used
(Self::unused).
enable.auto.commit answers the value postProcessParsedConfig
settled on: false without a group.id when it was not set.
§Arguments
key- the configuration name
§Returns
The value, None for Java’s null.
§Errors
Error::is_config_errorwith Java’sUnknown configuration '<key>'ifkeyis not a configuration this class defines.Error::is_local_illegal_argument_errorifkeyis a configuration of another type, where Java’s cast fails with aClassCastException.
Sourcepub fn get_string(&self, key: &str) -> Result<Option<&str>, Error>
pub fn get_string(&self, key: &str) -> Result<Option<&str>, Error>
The STRING configuration key, trimmed. Reading a key marks it used
(Self::unused).
client.id answers the resolved id: when the property is unset, new
derives it the way Java’s maybeOverrideClientId does, so this is the
id the consumer reports to the brokers. security.protocol answers the
value as written, trimmed ("sasl_ssl"), as Java’s does: its validator
accepts it case-insensitively without changing it. A PASSWORD
configuration that is not set answers None, as Java’s null default
casts to String.
§Arguments
key- the configuration name
§Returns
The value, None when it has no value (Java’s null, e.g. an unset
group.id).
§Errors
Error::is_config_errorwith Java’sUnknown configuration '<key>'ifkeyis not a configuration this class defines.Error::is_local_illegal_argument_errorifkeyis a configuration of another type, where Java’s cast fails with aClassCastException.
Sourcepub fn unused(&self) -> HashSet<String>
pub fn unused(&self) -> HashSet<String>
Returns the keys of the properties this configuration was built from that were never read: through a getter, or by the consumer built from it.
Sourcepub fn log_unused(&self)
pub fn log_unused(&self)
Info level log for any unused configurations
Sourcepub fn config_names() -> HashSet<String>
pub fn config_names() -> HashSet<String>
Trait Implementations§
Source§impl Debug for ConsumerConfig
impl Debug for ConsumerConfig
Source§impl Hash for ConsumerConfig
impl Hash for ConsumerConfig
Source§impl PartialEq for ConsumerConfig
impl PartialEq for ConsumerConfig
impl Eq for ConsumerConfig
Auto Trait Implementations§
impl !Freeze for ConsumerConfig
impl RefUnwindSafe for ConsumerConfig
impl Send for ConsumerConfig
impl Sync for ConsumerConfig
impl Unpin for ConsumerConfig
impl UnsafeUnpin for ConsumerConfig
impl UnwindSafe for ConsumerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.