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

Runtime values and outputs

Core Go 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
runtime.StreamStream metadata

GetName, GetTransformationName, GetTypeName, GetID, GetConfig, and GetEnvironment expose the current generated stream definition.

runtime.Collect[T]Operator output

Out(ctx, value) forwards a value to downstream consumers while preserving cancellation, tracing, priority, and correlation in the context.

runtime.StreamContext[T, R, E]Source endpoint context

Collect emits input values; ErrorCollect emits typed endpoint errors. Stream, ResultStream, and Logger expose the bound graph streams and logger.

runtime.SinkStreamContext[T, R, E]Sink endpoint context

Collect emits decoded responses and ErrorCollect emits typed failures. Log() returns the service logger.

datastruct.KeyValue[K, V]Keyed value

Carries the key and value produced by KeyBy and consumed by Join or MultiJoin streams.

environment.ServiceEnvironmentMaker dependency

Provides configured logging, metrics, tracing, runtime configuration, and service dependencies during object construction.

runtime/config.<Type>ConfigTyped configuration

The maker receives the generated config type for its stream or endpoint, such as ProcessStreamConfig or KafkaEndpointConfig.

Generated extension pattern

sc.Collect(ctx, value)       // normal source output
sc.ErrorCollect(ctx, err)  // typed error stream
out.Out(ctx, result)       // operator output