Crate relay_kafka

Source
Expand description

Kafka-related functionality.

By default, this library only provides the support for relay configuration. With producer feature enabled, the KafkaClient is provided and can be used to send messages to the Kafka broker.

§Usage

    use relay_kafka::{KafkaClient, KafkaTopic};

    // Get the builder.
    let mut builder = KafkaClient::builder();

    // Then one can add different configs per topic.
    builder = builder.add_kafka_topic_config(KafkaTopic::Events, &kafka_config_events).unwrap();

    // And add potentially another topic config.
    builder = builder.add_kafka_topic_config(KafkaTopic::Transactions, &kafka_config_metrics).unwrap();

    // build the client
    let kafka_client = builder.build();

    // send the message
    kafka_client.send_message(KafkaTopic::Events, 1u64, &kafka_message).unwrap();

If the configuration for the KafkaTopic was not added, attemps to send the message to this topic will return the error.

Structs§

KafkaClient
Keeps all the configured kafka producers and responsible for the routing of the messages.
KafkaClientBuilder
Helper structure responsible for building the actual KafkaClient.
KafkaConfigParam
A name value pair of Kafka config parameter.
KafkaParams
Config for creating a Kafka producer.
KafkaTopicConfig
A Kafka config for a topic.
KeyRateLimit
Produce rate limit configuration for a topic.
TopicAssignment
Configuration for a “logical” topic/datasink that Relay should forward data into.
TopicAssignments
Configuration for topics.
TopicConfig
Configuration for topic
Unused
A list of all currently, by this Relay, unused topic configurations.

Enums§

ClientError
Kafka producer errors.
ConfigError
Kafka configuration errors.
KafkaTopic
Define the topics over which Relay communicates with Sentry.

Traits§

Message
Describes the type which can be sent using kafka producer provided by this crate.