Skip to main content

Crate ruststream_nats

Crate ruststream_nats 

Source
Expand description

NATS / JetStream broker implementation for RustStream.

The lifecycle is the framework’s ladder of consuming transitions: NatsBroker::new captures the address synchronously, Broker::connect dials and yields a ConnectedNatsBroker, and ConnectedBroker::shutdown drains it into a ClosedNatsBroker. Subscriptions and publishers exist only from the connected form.

Publishing splits by transport rather than by flag: NatsPublish pairs into the Core NATS NatsPublisher (fire-and-forget, plus request/reply), and JetStreamPublish pairs into the JetStreamPublisher, which awaits the stream’s acknowledgement and can state what it expects the stream to look like.

Modules§

context
Optional typed per-delivery context exposing native JetStream metadata.

Structs§

ClosedNatsBroker
The terminal witness returned by shutting down a ConnectedNatsBroker.
ConnectedNatsBroker
The typed witness that Broker::connect succeeded: holds the live connection.
CoreMessage
Wrapper around an async_nats::Message from a core (non-JetStream) subscription.
JetStreamMessage
Wrapper around an async_nats::jetstream::Message with ack semantics.
JetStreamPublish
The JetStream publish policy: pure declaration, constructible anywhere.
JetStreamPublisher
The live JetStream publisher. Cheap to clone.
NatsBroker
A NATS broker: configuration captured, no I/O performed yet.
NatsPublish
The Core NATS publish policy: pure declaration, constructible anywhere.
NatsPublisher
The live Core NATS publisher. Cheap to clone.
NatsSubscriber
A NATS subscription.
PublishAck
The acknowledgement a JetStream stream returns for an accepted publish. PublishAck is an acknowledgment received after successfully publishing a message.
SubscribeOptions
Builder describing one subscription against a connected NATS broker (or its test counterpart).

Enums§

DeliverPolicy
DeliverPolicy determines how the consumer should select the first message to deliver.
NatsError
Errors surfaced by the NATS broker implementation.
NatsMessage
A NATS delivery. Two flavours: core NATS (no ack) and JetStream (real ack/nack/redelivery).

Constants§

PARTITION_KEY_HEADER
The well-known header key for per-message routing / partitioning.

Traits§

NatsPublishPolicy
A publish policy that pairs with a connected NATS broker without I/O.