Skip to main content

Module runtime

Module runtime 

Source
Expand description

Application object, middleware and dispatch.

Re-exports§

pub use crate::Extensions;

Modules§

cli
The process entry point generated by #[ruststream::app].
layers
Bundled, opinionated middleware layers ready to drop into a handler stack.

Structs§

After
A builder for an outcome-gated post-settle hook, returned by Context::after.
AppInfo
Service-level metadata, surfaced to the AsyncAPI generator as the spec Info object.
BatchPublishingHandler
The BatchHandler built from a BatchPublishingDef: decode the batch, run the handler, publish the replies through the ReplyPublisher, then ack the batch.
BrokerScope
A handler-registration scope bound to one broker.
Context
Per-delivery context, threaded through middleware and into the handler.
DynStack
A Layer that runs a frozen list of DynMiddleware before the handler it wraps.
DynStackHandler
Handler produced by DynStack::layer. Runs the frozen middleware chain, then the wrapped handler.
FailurePolicies
The pair of failure policies a subscriber carries: one for a handler panic, one for a decode failure. Threaded from the def to the dispatch loop alongside the Workers policy.
HandlerMetadata
Descriptive metadata for a registered subscriber handler.
Identity
The identity Layer: returns the handler unchanged. The default global stack on RustStream.
Next
A cursor over the remaining middleware in a DynStack, ending in the wrapped handler.
Outgoing
A mutable outgoing message flowing through the publish pipeline.
PublishIdentity
The no-op PublishLayer: the default for a TypedPublisher with no static transforms.
PublishNext
A cursor over the remaining publish middleware, ending in the broker publisher.
PublishStack
Composes two PublishLayers: inner runs first, then outer. Built by TypedPublisher::layer; you rarely name it directly.
PublishingHandler
The Handler built from a PublishingDef: decode, run, encode the reply, publish, ack.
Router
A statically-typed, lazily-bound group of handler registrations, not attached to any broker.
RouterSink
The runtime collector a router mounts into: type-erased starters plus handler metadata.
RustStream
The top-level application object.
ScopedPublisher
A named publisher resolved from a Context, sending through the scope’s publish pipeline.
Settle
The settlement of one dispatched message: the HandlerResult outcome the dispatcher acts on, plus an optional post-settle continuation.
Stack
Composes two layers into one: inner is applied first (innermost), outer wraps it.
State
App-level shared state: a type-map holding one value per type.
Transactional
A TypedPublisher whose batch replies are published inside one broker transaction.
Typed
Handler produced by typed. Override the decode-failure policy with Typed::on_decode_failure.
TypedBatch
The decode adapter for batches, the Typed counterpart.
TypedPublisher
A byte Publisher paired with a Codec and a static PublishLayer stack, ready to send typed values.
Workers
Concurrency policy for one subscriber’s dispatch loop, declared with the workers(..) macro argument (or Workers::sequential by default).

Enums§

BatchResult
The settlement of one dispatched batch.
FailurePolicy
What a subscriber does when it cannot process a message.
HandlerResult
What the router should do with the message after the handler returns.
RustStreamError
Errors surfaced while running a RustStream service.

Constants§

RETRY_COUNT_HEADER
Header carrying the framework’s deferred-republish retry count.

Traits§

BatchDef
A batch handler definition produced by #[subscriber(batch(..))].
BatchPublishingDef
A batch subscriber definition that produces replies to publish.
BlanketLayer
A Layer that wraps a handler on any message type, not one fixed H.
DynMiddleware
A middleware in the around / next style, operating on a borrowed input I and its Context.
ErasedPublisher
A publisher with its concrete type and error erased.
Handler
A handler invoked on each input it is given.
HandlerExt
Convenience extension trait for fluent layer stacking on any Handler.
IntoBatchResult
Conversion into a BatchResult, so #[subscriber(batch(..))] handlers can return a plain value.
IntoSettle
Conversion into a Settle, so #[subscriber] handlers can return a plain value instead of always constructing one.
Layer
A function from one handler to another. Apply with HandlerExt::with.
PublishLayer
A static, compile-time publish transform: mutates an Outgoing before it is sent.
PublishMiddleware
Middleware that transforms (or observes) an Outgoing message before it is published.
PublishingDef
A subscriber definition that produces a reply to publish.
ReplyPublisher
The reply wiring accepted by the include_batch_publishing mounts.
RouterDef
A mountable group of handler registrations.
SliceHandler
A handler invoked with one whole decoded batch.
SubscriberDef
A handler definition produced by the #[subscriber] macro.

Functions§

typed
Build a Handler<M> that decodes the payload with codec into T and forwards &T to inner.