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

Runtime values and outputs

Core C++ userver 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
servicelib::MessageContextPer-message context

Carries stream ID and runtime propagation state. Pass or move it into every output so downstream work remains correlated.

servicelib::ContextLifecycle context

Used by maker and service lifecycle code; it is distinct from the per-message MessageContext.

servicelib::StreamBaseStream metadata

Reference to the generated stream currently invoking the callable.

Output / ErrorOutputCallable outputs

Framework-supplied adapters. out(context, value) or .out(context, value) emits normal or error values according to the generated callable signature.

servicelib::Payload<T>Shared payload

Owns or shares a typed value across asynchronous graph calls without forcing unnecessary copies.

servicelib::SourceStreamContext<T, R, E>Source endpoint context

collect and collectError emit decoded values and typed failures.

servicelib::SinkStreamContext<T, R, E>Sink endpoint context

collect emits transport results and collectError emits typed failures.

servicelib::BeginResult<State>Endpoint begin result

Returns the message context and request-local handler state together.

servicelib::IServiceEnvironmentMaker dependency

Exposes runtime configuration, logger, metrics, tracing, and registered service dependencies.

Generated extension pattern

stream.collect(std::move(context), std::move(value));
stream.collectError(std::move(context), error);