relay_kafka/lib.rs
1//! Kafka-related functionality.
2//!
3//! By default, this library only provides the support for `relay` configuration. With `producer`
4//! feature enabled, the [`KafkaClient`] is provided and can be used to send messages to the Kafka
5//! broker.
6//!
7//! # Usage
8//!
9//! ```compile_fail
10//! use relay_kafka::{KafkaClient, KafkaTopic};
11//!
12//! // Get the builder.
13//! let mut builder = KafkaClient::builder();
14//!
15//! // Then one can add different configs per topic.
16//! builder = builder.add_kafka_topic_config(KafkaTopic::Events, &kafka_config_events).unwrap();
17//!
18//! // And add potentially another topic config.
19//! builder = builder.add_kafka_topic_config(KafkaTopic::Transactions, &kafka_config_metrics).unwrap();
20//!
21//! // build the client
22//! let kafka_client = builder.build();
23//!
24//! // send the message
25//! kafka_client.send_message(KafkaTopic::Events, 1u64, &kafka_message).unwrap();
26//! ```
27//!
28//! If the configuration for the [`KafkaTopic`] was not added, attemps to send the message to this
29//! topic will return the error.
30#![warn(missing_docs)]
31#![warn(missing_debug_implementations)]
32#![doc(
33 html_logo_url = "https://raw.githubusercontent.com/getsentry/relay/master/artwork/relay-icon.png",
34 html_favicon_url = "https://raw.githubusercontent.com/getsentry/relay/master/artwork/relay-icon.png"
35)]
36
37mod config;
38#[cfg(feature = "producer")]
39mod producer;
40#[cfg(feature = "producer")]
41mod statsd;
42
43pub use config::*;
44#[cfg(feature = "producer")]
45pub use producer::*;