faucet_sink_nats/lib.rs
1#![cfg_attr(docsrs, feature(doc_cfg))]
2
3//! # faucet-sink-nats
4//!
5//! A [NATS](https://nats.io) sink for `faucet-stream`. Publishes each record as
6//! a JSON message to a subject — fixed, or per-record via a configurable
7//! `subject_field`. The client is flushed after each batch so nothing is left
8//! buffered when the write returns.
9//!
10//! Append-only: it does not override idempotency, upsert, or schema-evolution
11//! (the trait defaults hold).
12//!
13//! ```no_run
14//! use faucet_sink_nats::{NatsSink, NatsSinkConfig};
15//! # async fn ex() -> Result<(), faucet_core::FaucetError> {
16//! let sink = NatsSink::new(NatsSinkConfig::new("events.out")).await?;
17//! # let _ = sink;
18//! # Ok(())
19//! # }
20//! ```
21
22pub mod config;
23pub mod sink;
24
25pub use config::NatsSinkConfig;
26pub use sink::NatsSink;
27
28// Re-export shared config types so downstream users import from one place.
29pub use faucet_common_nats::{NatsAuth, NatsConnectionConfig, NatsTls};
30pub use faucet_core::{FaucetError, Sink};
31
32/// The connector's static descriptor (RFC 0013): its capabilities, answered from config alone.
33pub const DESCRIPTOR: faucet_core::ConnectorDescriptor =
34 faucet_core::ConnectorDescriptor::new("nats", faucet_core::capabilities::append_only_sink);