Context + Stream + Collector + EnvironmentRuntime 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.
runtime.StreamStream metadataGetName, GetTransformationName, GetTypeName, GetID, GetConfig, and GetEnvironment expose the current generated stream definition.
runtime.Collect[T]Operator outputOut(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 contextCollect 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 contextCollect emits decoded responses and ErrorCollect emits typed failures. Log() returns the service logger.
datastruct.KeyValue[K, V]Keyed valueCarries the key and value produced by KeyBy and consumed by Join or MultiJoin streams.
environment.ServiceEnvironmentMaker dependencyProvides configured logging, metrics, tracing, runtime configuration, and service dependencies during object construction.
runtime/config.<Type>ConfigTyped configurationThe 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