pub struct KafkaInputConfig {Show 16 fields
pub kafka_options: BTreeMap<String, String>,
pub topic: String,
pub log_level: Option<KafkaLogLevel>,
pub group_join_timeout_secs: u32,
pub poller_threads: Option<usize>,
pub start_from: KafkaStartFromConfig,
pub region: Option<String>,
pub partitions: Option<Vec<i32>>,
pub resume_earliest_if_data_expires: bool,
pub include_headers: Option<bool>,
pub include_timestamp: Option<bool>,
pub include_partition: Option<bool>,
pub include_offset: Option<bool>,
pub include_topic: Option<bool>,
pub synchronize_partitions: bool,
pub header_filter: Option<HeaderFilter>,
}Expand description
Configuration for reading data from Kafka topics with InputTransport.
Fields§
§kafka_options: BTreeMap<String, String>Options passed directly to rdkafka.
librdkafka options
used to configure the Kafka consumer.
This input connector does not use consumer groups, so options related to consumer groups are rejected, including:
group.id, if present, is ignored.auto.offset.reset(usestart_frominstead).- “enable.auto.commit”, if present, must be set to “false”.
- “enable.auto.offset.store”, if present, must be set to “false”.
topic: StringTopic to subscribe to.
log_level: Option<KafkaLogLevel>The log level of the client.
If not specified, the log level will be calculated based on the global
log level of the log crate.
group_join_timeout_secs: u32Maximum timeout in seconds to wait for the endpoint to join the Kafka consumer group during initialization.
poller_threads: Option<usize>Set to 1 or more to fix the number of threads used to poll
rdkafka. Multiple threads can increase performance with small Kafka
messages; for large messages, one thread is enough. In either case, too
many threads can harm performance. If unset, the default is 3, which
helps with small messages but will not harm performance with large
messagee
start_from: KafkaStartFromConfigWhere to begin reading the topic.
region: Option<String>The AWS region to use while connecting to AWS Managed Streaming for Kafka (MSK).
partitions: Option<Vec<i32>>The list of Kafka partitions to read from.
Only the specified partitions will be consumed. If this field is not set, the connector will consume from all available partitions.
If start_from is set to offsets and this field is provided, the
number of partitions must exactly match the number of offsets, and the
order of partitions must correspond to the order of offsets.
If offsets are provided for all partitions, this field can be omitted.
resume_earliest_if_data_expires: boolBy default, if the input connector resumes from a checkpoint and the data where it needs to resume has expired from the Kafka topic, the input connector fails initialization and the pipeline will fail to start.
Set this to true to change the behavior so that, if data is not available on resume, the input connector starts from the earliest offsets that are now available.
include_headers: Option<bool>Whether to include Kafka headers in the record metadata.
When true, Kafka message headers are available via the CONNECTOR_METADATA() function.
See https://docs.feldera.com/connectors/sources/kafka#metadata for details.
include_timestamp: Option<bool>Whether to include Kafka message timestamp in the record metadata.
When true, Kafka message timestamp is available via the CONNECTOR_METADATA() function.
See https://docs.feldera.com/connectors/sources/kafka#metadata for details.
include_partition: Option<bool>Whether to include Kafka partition in the record metadata.
When true, Kafka partition from which the message was read is available via the CONNECTOR_METADATA() function.
See https://docs.feldera.com/connectors/sources/kafka#metadata for details.
include_offset: Option<bool>Whether to include Kafka message offset in the record metadata.
When true, Kafka message offset is available via the CONNECTOR_METADATA() function.
See https://docs.feldera.com/connectors/sources/kafka#metadata for details.
include_topic: Option<bool>Whether to include Kafka topic in the record metadata.
When true, Kafka topic from which the message was read is available via the CONNECTOR_METADATA() function.
See https://docs.feldera.com/connectors/sources/kafka#metadata for details.
synchronize_partitions: boolWhen lateness is enabled on a Feldera table, Feldera only produces correct output if input arrives approximately in order within the bounds of the lateness. The Feldera Kafka input connector can reorder input when there are multiple partitions:
-
If partitions start at different times, then reading all the partitions in parallel will naturally consume data out of order.
-
Even if they start at the same time, partitions might contain events at different rates.
-
Even if the partitions start at the same time and have the same number of events per unit time, if partitions are spread across brokers, different brokers may fetch data at different rates.
-
Even if all of the partitions are on a single broker, one cannot expect all of the partitions to naturally remain exactly in sync forever.
Setting this option to true addresses the issue by synchronizing
ingestion across partitions, ingesting records in order of their Kafka
event timestamps.
Pitfalls of this solution include:
-
Kafka event timestamps are not necessarily monotonically increasing even within a single partition. If timestamps jump backward beyond the lateness, then this can also cause correctness problems.
(This can be avoided by keeping clocks on Kafka producers and brokers synchronized.)
-
If an event with a timestamp far in the future is added to a partition, that event, and all those that follow it, will never be processed.
-
If one or a few partitions have timestamps far behind the others, only those partitions will be processed until all the old events are processed. (This is the flip side of the previous pitfall.)
-
One or more empty partitions will prevent any data from being processed at all, because there is no way to know the timestamp for the first event that will be added to that partition.
-
In a topic with
Nnonempty partitions, at leastN - 1events will always be left unprocessed (one in each ofN - 1partitions), because there is no way to know the timestamp for the next event to be added to the partition whose events have been completely processed.
header_filter: Option<HeaderFilter>Drop incoming messages whose Kafka headers do not satisfy this filter.
The filter is a boolean expression (and, or, not) over regular
expression tests on individual header values (see HeaderFilter).
Messages that do not satisfy the filter are dropped before parsing and
never reach the pipeline. When absent (the default), all messages are
admitted.
Filtering is independent of include_headers: it works whether or not
the matched headers are also surfaced to SQL via CONNECTOR_METADATA().
Implementations§
Source§impl KafkaInputConfig
impl KafkaInputConfig
Sourcepub fn default(
kafka_options: BTreeMap<String, String>,
topic: impl Into<String>,
) -> Self
pub fn default( kafka_options: BTreeMap<String, String>, topic: impl Into<String>, ) -> Self
Returns a default KafkaInputConfig with the given kafka_options and
topic. To be a usable configuration, kafka_options must contain at
least bootstrap.servers.
pub fn poller_threads(&self) -> usize
pub fn metadata_requested(&self) -> bool
Trait Implementations§
Source§impl Clone for KafkaInputConfig
impl Clone for KafkaInputConfig
Source§impl Debug for KafkaInputConfig
impl Debug for KafkaInputConfig
Source§impl<'de> Deserialize<'de> for KafkaInputConfig
impl<'de> Deserialize<'de> for KafkaInputConfig
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for KafkaInputConfig
Source§impl PartialEq for KafkaInputConfig
impl PartialEq for KafkaInputConfig
Source§impl Serialize for KafkaInputConfig
impl Serialize for KafkaInputConfig
impl StructuralPartialEq for KafkaInputConfig
Auto Trait Implementations§
impl Freeze for KafkaInputConfig
impl RefUnwindSafe for KafkaInputConfig
impl Send for KafkaInputConfig
impl Sync for KafkaInputConfig
impl Unpin for KafkaInputConfig
impl UnsafeUnpin for KafkaInputConfig
impl UnwindSafe for KafkaInputConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.