Skip to main content

faucet_sink_rabbitmq/
lib.rs

1#![cfg_attr(docsrs, feature(doc_cfg))]
2
3//! # faucet-sink-rabbitmq
4//!
5//! A [RabbitMQ](https://www.rabbitmq.com) (AMQP 0.9.1) sink for
6//! `faucet-stream`, built on the pure-Rust [`lapin`](https://crates.io/crates/lapin)
7//! client. Publishes each record to an exchange (the default exchange unless
8//! configured) with a static, per-field, or JSONPath-derived routing key.
9//!
10//! Publisher confirms are on by default: a write returns only once the broker
11//! has acknowledged every message. With `mandatory: true`, an unroutable
12//! message is returned by the broker and surfaces as a per-row error through
13//! `write_batch_partial`, so it can be routed to a dead-letter queue.
14//!
15//! Append-only: it does not override idempotency, upsert, or schema evolution
16//! (the trait defaults hold).
17//!
18//! ```no_run
19//! use faucet_sink_rabbitmq::{RabbitMqSink, RabbitMqSinkConfig};
20//! # async fn ex() -> Result<(), faucet_core::FaucetError> {
21//! let sink = RabbitMqSink::new(RabbitMqSinkConfig::to_queue("orders")).await?;
22//! # let _ = sink;
23//! # Ok(())
24//! # }
25//! ```
26
27pub mod config;
28pub mod sink;
29
30pub use config::RabbitMqSinkConfig;
31pub use sink::RabbitMqSink;
32
33pub use faucet_common_rabbitmq::{
34    RabbitMqAuth, RabbitMqConnectionConfig, RabbitMqExchangeKind, RabbitMqTls, RabbitMqValueFormat,
35};
36pub use faucet_core::{FaucetError, Sink};
37
38/// The connector's static descriptor (RFC 0013): its capabilities, answered from config alone.
39pub const DESCRIPTOR: faucet_core::ConnectorDescriptor =
40    faucet_core::ConnectorDescriptor::new("rabbitmq", faucet_core::capabilities::append_only_sink);