ruststream_zeromq/lib.rs
1//! `ZeroMQ` transport implementation of the `RustStream` broker contract, for bridging to
2//! non-Rust peers.
3//!
4//! Unlike every other broker crate, this one has no server in the middle: which side listens
5//! is a deployment decision, stated explicitly on the [`ZmqEndpoint`]. Three socket patterns
6//! cover three messaging shapes, over the pure-Rust
7//! [`zeromq`](https://docs.rs/zeromq) implementation (TCP and IPC transports):
8//!
9//! - [`ZmqQueue`] - PUSH/PULL: competing consumers, round-robin.
10//! - [`ZmqFanout`] - PUB/SUB: broadcast, prefix filtering by name.
11//! - [`ZmqRpc`] - DEALER/ROUTER: request and reply.
12//!
13//! The frame layout is part of the public contract, because the peer on the other side
14//! composes messages by hand: frame 0 is the name (also the subscription prefix for the
15//! fan-out pattern), frame 1 the headers (`"name: value"` lines; may be empty), frame 2 the
16//! payload. A Python peer sends
17//! `socket.send_multipart([b"orders", b"", payload])`.
18//!
19//! Honest scope, stated here rather than discovered: delivery is at most once and there is
20//! no durability, so acknowledgement is reported as unsupported rather than emulated; a
21//! subscriber that connects after a publisher has started misses what was sent before it
22//! arrived; the implementation has no encryption layer, so it is for trusted networks or for
23//! use inside an existing tunnel; and it exposes no high-water-mark configuration - a slow
24//! reader exerts raw TCP back-pressure on senders, except the fan-out pattern, which drops
25//! unmatched messages by design.
26
27#![forbid(unsafe_code)]
28
29mod common;
30mod endpoint;
31mod error;
32mod fanout;
33mod message;
34mod queue;
35mod rpc;
36#[cfg(feature = "testing")]
37pub mod testing;
38mod wire;
39
40pub use endpoint::ZmqEndpoint;
41pub use error::ZmqError;
42pub use fanout::{ConnectedZmqFanout, ZmqFanout, ZmqFanoutPublish, ZmqFanoutPublisher};
43pub use message::ZmqMessage;
44pub use queue::{ConnectedZmqQueue, ZmqQueue, ZmqQueuePublish, ZmqQueuePublisher, ZmqSubscriber};
45pub use rpc::{ConnectedZmqRpc, ZmqRpc, ZmqRpcPublish, ZmqRpcPublisher};