Skip to main content

KafkaInputConfig

Struct KafkaInputConfig 

Source
pub struct KafkaInputConfig {
Show 17 fields pub kafka_options: BTreeMap<String, String>, pub topic: String, pub log_level: Option<KafkaLogLevel>, pub group_join_timeout: Option<ConfigDuration>, pub poller_threads: Option<usize>, pub start_from: KafkaStartFromConfig, pub region: Option<String>, pub oauth_provider: Option<KafkaOauthProvider>, 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 (use start_from instead).
  • “enable.auto.commit”, if present, must be set to “false”.
  • “enable.auto.offset.store”, if present, must be set to “false”.
§topic: String

Topic 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: Option<ConfigDuration>

Maximum time to wait for the endpoint to join the Kafka consumer group during initialization, for example 10s. Unset selects the default, DEFAULT_GROUP_JOIN_TIMEOUT.

§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: KafkaStartFromConfig

Where to begin reading the topic.

§region: Option<String>

The AWS region to use while connecting to AWS Managed Streaming for Kafka (MSK).

§oauth_provider: Option<KafkaOauthProvider>

Identity provider used to mint SASL/OAUTHBEARER tokens.

Skipped when serializing so that a manager that knows this field can still drive an older runtime that does not: such a runtime folds the unknown key into the flattened kafka_options: BTreeMap<String, String> and rejects a null value.

§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: bool

By 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: bool

When 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 N nonempty partitions, at least N - 1 events will always be left unprocessed (one in each of N - 1 partitions), 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

Source

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.

Source

pub fn poller_threads(&self) -> usize

Source

pub fn metadata_requested(&self) -> bool

Source§

impl KafkaInputConfig

Source

pub fn group_join_timeout(&self) -> ConfigDuration

The consumer-group join timeout in effect, or DEFAULT_GROUP_JOIN_TIMEOUT.

Source§

impl KafkaInputConfig

Source

pub fn validate(&mut self) -> AnyResult<()>

Validate configuration, set default option values required by this adapter.

Trait Implementations§

Source§

impl Clone for KafkaInputConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KafkaInputConfig

Source§

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

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

impl<'de> Deserialize<'de> for KafkaInputConfig

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for KafkaInputConfig

Source§

impl PartialEq for KafkaInputConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for KafkaInputConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for KafkaInputConfig

Source§

impl<'__s> ToSchema<'__s> for KafkaInputConfig

Source§

fn schema() -> (&'__s str, RefOr<Schema>)

Return a tuple of name and schema or reference to a schema that can be referenced by the name or inlined directly to responses, request bodies or parameters.
Source§

fn aliases() -> Vec<(&'__s str, Schema)>

Optional set of alias schemas for the ToSchema::schema. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more