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. The last argument opts the topic into a
16//! // client that is replaced when the Kafka config changes; `None` keeps it fixed.
17//! builder = builder.add_kafka_topic_config(KafkaTopic::Events, &kafka_config_events, false, None).unwrap();
18//!
19//! // And add potentially another topic config.
20//! builder = builder.add_kafka_topic_config(KafkaTopic::Transactions, &kafka_config_metrics, false, None).unwrap();
21//!
22//! // build the client
23//! let kafka_client = builder.build();
24//!
25//! // send the message
26//! kafka_client.send_message(KafkaTopic::Events, 1u64, &kafka_message).unwrap();
27//! ```
28//!
29//! If the configuration for the [`KafkaTopic`] was not added, attemps to send the message to this
30//! topic will return the error.
31#![warn(missing_docs)]
32#![warn(missing_debug_implementations)]
33#![doc(
34 html_logo_url = "https://raw.githubusercontent.com/getsentry/relay/master/artwork/relay-icon.png",
35 html_favicon_url = "https://raw.githubusercontent.com/getsentry/relay/master/artwork/relay-icon.png"
36)]
37
38mod config;
39#[cfg(feature = "producer")]
40mod debounced;
41#[cfg(feature = "producer")]
42mod limits;
43#[cfg(feature = "producer")]
44mod producer;
45#[cfg(feature = "producer")]
46mod statsd;
47
48pub use config::*;
49#[cfg(feature = "producer")]
50pub use producer::*;