Skip to main content

Crate ruststream

Crate ruststream 

Source
Expand description

Rust core of the RustStream messaging framework: broker-agnostic traits, message types, codecs, router runtime, and a conformance harness for broker authors.

§Cargo features

The core traits, the runtime::RustStream application object, middleware, and dispatch are always present. The rest is additive and opt-in. Codec features are mutually compatible and enable only the deserializers you need.

  • json (default): codec::JsonCodec.
  • msgpack: [codec::MsgpackCodec].
  • cbor: [codec::CborCodec].
  • memory: [memory::MemoryBroker], an in-process broker usable in applications, prototypes and tests.
  • macros: the #[subscriber], #[ruststream::app], and #[derive(Message)] macros.
  • asyncapi: AsyncAPI document generation and the HTML viewer.
  • metrics: Prometheus metrics middleware and exporter.
  • logging: colored, RUST_LOG-driven console logging via tracing-subscriber ([logging::init]). The generated cli run command installs it automatically.
  • conformance: the [conformance::harness] contract suite, per-capability suites in [conformance::capabilities], and broker-agnostic [conformance::helpers] for application tests. Generic over any broker’s TestClient, so it pulls in no concrete broker (enable memory too to run it against [memory::MemoryBroker]).
  • cli: the ruststream binary (run, asyncapi gen, new).

Disable defaults (default-features = false) to drop the bundled JSON codec; the core traits, runtime, and dispatch remain. Add back only what you need.

Re-exports§

pub use runtime::RustStream;

Modules§

codec
Pluggable serialization codecs.
runtime
Application object, middleware and dispatch.
testing
The TestClient trait: contract for a broker’s in-process test transport.

Structs§

Buffered
A SubscriptionSource adapter that buffers the wrapped source’s subscriber into a BatchSubscriber.
BufferedSubscriber
The subscriber Buffered opens: the wrapped source’s subscriber plus client-side batching.
Extensions
A per-delivery type-map: at most one value per type, scoped to a single delivery.
Headers
Case-insensitive map of broker-message headers.
Name
The default SubscriptionSource: subscribe by name string via the Subscribe capability.
OutgoingMessage
A message ready to be published, holding borrowed payload and name.
RawMessage
An owned snapshot of a message as it travels through the framework.
ServerSpec
How to reach a broker, for the servers section of an AsyncAPI document.

Enums§

AckError
Errors returned by IncomingMessage::ack and IncomingMessage::nack.

Traits§

BatchSubscriber
A subscriber that natively delivers messages in batches.
Broker
A connection to a message broker, owning its lifecycle.
DescribeServer
A broker that describes itself as an AsyncAPI server.
IncomingMessage
A message delivered by a Subscriber.
Message
Metadata about a message type, used to name and describe it in an AsyncAPI document.
Partitioned
Messages or publishers that carry a routing key for broker-side partitioning.
Publisher
A producer that sends messages into the broker.
RequestReply
A publisher that supports synchronous request / reply messaging.
Subscribe
A broker whose subscriptions are fully determined by a name string.
Subscriber
A consumer attached to one or more broker names.
SubscriptionSource
A description of one subscription, resolved against a concrete broker at startup.
TransactionalPublisher
A publisher that supports broker-side transactions.