SAService Architect Back to designer
SAService ArchitectDocumentation
Framework reference Context + Stream + Collector + Environment

Runtime values and outputs

Core Rust values passed into makers, operators, and endpoint handlers. These are the stable application-facing handles to the generated runtime.

When to use

Use this page while implementing a generated business function or endpoint handler.

Behavior

  • Contexts carry cancellation and correlation across graph boundaries.
  • Collectors and stream contexts are the supported way to emit values; calling downstream functions directly bypasses graph semantics and observability.
  • The service environment is supplied during construction so business implementations can create scoped metrics, obtain loggers, and resolve configured dependencies.

Core runtime types

Types normally visible in preserved implementation signatures.

Type or methodRoleDescription
MessageContextPer-message context

Carries cancellation and correlation metadata. Pass ownership into collect so downstream tasks receive the same context.

&dyn RuntimeStreamStream metadata

Provides the current generated stream through a trait object without exposing its concrete implementation.

Collector<T>Operator output

collect(context, value).await forwards an owned value; clone only when business logic must retain another copy.

StreamContext<T, R, E>Source endpoint context

collect and error_collect emit typed values into the graph.

SinkStreamContext<T, R, E>Sink endpoint context

Emits typed transport results and endpoint errors.

Payload<T>Shared payload

Uses Arc<T> semantics so graph fan-out can share immutable values efficiently.

RuntimeEnvironmentMaker dependency

Cloneable handle to runtime configuration, logging, metrics, tracing, and dependencies.

RuntimeResult<T>Construction result

Returns the implementation or a startup error from a maker.

Generated extension pattern

stream.collect(context, value).await;
stream.error_collect(context, error).await;
out.collect(context, result).await;