datum-mq 0.10.5

Kafka sources and sinks for Datum streams, with native and rdkafka backends
Documentation
#![forbid(unsafe_code)]
//! Kafka sources and sinks for Datum streams.
//!
//! `datum-mq` is an additive Datum satellite crate with a Tokio-native Kafka
//! consumer by default. Its default-on `rdkafka` Cargo feature adds the
//! selectable librdkafka consumer backend and the default producer backend.
//! Disable default features to build only the native backends without
//! librdkafka or its CMake build.
//!
//! The shipped guarantee is at-least-once. [`KafkaSource::committable`] emits a
//! [`datum::SourceWithContext`] whose context is a [`KafkaOffset`]; downstream
//! code commits that offset only after its own checkpoint/side effect succeeds.
//! With the `rdkafka` feature, [`KafkaSink`] uses idempotent `rdkafka`
//! production by default and its materialized [`KafkaProducerControl`] drains
//! final acknowledgements before shutdown. Without it, the TLS/SASL-capable
//! native producer is the only backend and therefore the default.
//! It uses bounded, partition-ordered Produce pipelining and is intentionally
//! non-idempotent: a lost response can duplicate an accepted partition batch.
//! Kafka transactions and consume-transform-produce EOS are deferred.

mod config;
mod error;
mod metrics;
mod native;
mod offset;
#[doc(hidden)]
pub mod profile;
mod record;
mod sink;
mod source;

pub use config::{
    CommitPolicy, KafkaConfig, KafkaConsumerBackend, KafkaConsumerSettings, KafkaProducerBackend,
    KafkaProducerSettings, Offset, Subscription, TopicPartitionOffset,
};
pub use error::{MqError, MqResult};
pub use metrics::{KafkaMetrics, KafkaMetricsSnapshot};
pub use offset::{KafkaBatchOffset, KafkaOffset, KafkaOffsetBatch, OffsetCommit, TopicPartition};
pub use record::{ConsumerRecord, KafkaHeader, KafkaTimestamp, ProducerRecord};
pub use sink::{KafkaProducerControl, KafkaSink};
pub use source::{KafkaControl, KafkaPayloadBatch, KafkaPayloadRecord, KafkaSource};

/// The `datum-mq` crate version.
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

#[cfg(feature = "rdkafka")]
pub(crate) const fn consumer_rdkafka_hint() -> &'static str {
    "select KafkaConsumerBackend::Rdkafka"
}

#[cfg(not(feature = "rdkafka"))]
pub(crate) const fn consumer_rdkafka_hint() -> &'static str {
    "enable the datum-mq Cargo feature `rdkafka` and select KafkaConsumerBackend::Rdkafka"
}

#[cfg(feature = "rdkafka")]
pub(crate) const fn producer_rdkafka_hint() -> &'static str {
    "select KafkaProducerBackend::Rdkafka"
}

#[cfg(not(feature = "rdkafka"))]
pub(crate) const fn producer_rdkafka_hint() -> &'static str {
    "enable the datum-mq Cargo feature `rdkafka` and select KafkaProducerBackend::Rdkafka"
}