datum-mq 0.10.1

Kafka sources and sinks for Datum streams, backed by rdkafka
Documentation
use datum::StreamError;
use thiserror::Error;

/// Result type used by `datum-mq`.
pub type MqResult<T> = Result<T, MqError>;

/// Kafka connector errors.
#[derive(Debug, Error)]
pub enum MqError {
    #[error("Kafka client error: {0}")]
    Kafka(#[from] rdkafka::error::KafkaError),

    #[error("invalid Kafka configuration: {0}")]
    InvalidConfig(String),

    #[error("Kafka control handle is not available")]
    ControlUnavailable,

    #[error("Kafka assignment was lost for {topic}:{partition}; refusing to commit offset")]
    AssignmentLost { topic: String, partition: i32 },

    #[error("Kafka drain timed out")]
    DrainTimeout,

    #[error("Kafka producer delivery failed: {0}")]
    Delivery(String),

    #[error("Kafka operation failed: {0}")]
    Failed(String),
}

impl From<MqError> for StreamError {
    fn from(error: MqError) -> Self {
        StreamError::Failed(error.to_string())
    }
}