portable library
Runtime-neutral Stem API for producers and event-driven task execution.
This entrypoint excludes VM worker lifecycle, process signals, isolate transport, filesystem stores, and host-specific configuration.
Classes
- AtomicTerminalResultBackend
- Compatibility name for existing result backend implementations.
- AtomicTerminalResultStore
- Optional atomic terminal-state arbitration for result backends.
- BroadcastDefinition
- Broadcast channel declaration.
- Broker
- Abstract broker compatibility facade implemented by queue adapters.
- BrokerCapabilities
- Runtime-declared capabilities of a broker adapter.
- BrokerCapabilitiesProvider
- Optional provider interface for adapters with capability declarations that are more precise than the legacy Broker getters.
- CalendarScheduleSpec
- Schedule specification that matches specific calendar attributes.
- ClockedScheduleSpec
- Schedule specification for a fixed, absolute run time.
-
CodecTaskPayloadEncoder<
T> - Bridges a typed Codec into the existing TaskPayloadEncoder contract.
- ConsoleMetricsExporter
- Simple exporter that prints JSON metrics to either sink or stdout.
- CronScheduleSpec
- Schedule specification for standard Cron expressions.
- DartasticMetricsExporter
- Metrics exporter that relays events through Dartastic's OTLP pipeline.
- DartasticSdkMetricsExporter
- Metrics exporter that uses an already configured Dartastic SDK provider.
- DeadLetterBroker
- Optional broker capability for dead-letter inspection and replay.
- DeadLetterEntry
- Dead letter queue entry containing the failed envelope and metadata.
- DeadLetterPage
- Page of dead letter results with optional continuation offset.
- DeadLetterReplayResult
- Result describing entries considered for replay.
- DefaultQueueConfig
-
Default queue alias configuration tying
aliasto a canonical queue name. - Delivery
- Runtime wrapper containing the envelope plus broker-specific receipt info.
- EmitWorkflowEventRequest
- Workflow event emit request payload for isolate communication.
- EmitWorkflowEventResponse
- Response payload for isolate workflow event emit requests.
- EmitWorkflowEventSignal
- Request to emit a workflow event from an isolate.
- EnqueueTaskSignal
- Request to enqueue a task from an isolate.
- Envelope
- Task payload persisted inside a broker. Since: 0.1.0
- ExponentialJitterRetryStrategy
- Exponential backoff with jitter, capped at a configurable duration.
- ExtendLeaseSignal
- Signals a request to extend a task lease.
- FencedLock
- A lock handle that carries a monotonically increasing fencing token.
-
FunctionTaskHandler<
R> -
Convenience task handler that delegates execution to a top-level function
suitable for isolate execution. Set runInIsolate to
falseor use FunctionTaskHandler.inline to keep execution in the worker isolate. - GroupDescriptor
- Descriptor for group (e.g., chord) aggregation.
- GroupResultStore
- Persistence capability for task groups and chord arbitration.
- GroupStatus
- Aggregated status for a group/chord.
- HeartbeatSignal
- Signals a heartbeat from an executing task.
- InMemoryTaskRegistry
- Default in-memory registry implementation.
- InspectableBroker
- Optional broker capability for queue-depth inspection.
- IntervalScheduleSpec
- Schedule specification for fixed time intervals.
- JsonTaskPayloadEncoder
- Default encoder that stores payloads verbatim as JSON-friendly values.
- LeaseBroker
- Optional broker capability for extending active delivery leases.
- Lock
- Handle to a lock acquired from a LockStore.
- LockStore
- Lock store used for unique jobs or scheduling coordination. Since: 0.1.0
- MetricEvent
- Immutable metric event emitted to exporters.
- MetricsExporter
- Consumers implement exporters to relay metric events to specific sinks.
- Middleware
- Middleware hook invoked for lifecycle events around enqueue/consume/execute. Since: 0.1.0
-
NoArgsTaskDefinition<
TResult> - Typed producer-facing definition for tasks that take no input args.
-
PayloadCodec<
T> - Encodes and decodes a strongly-typed payload value.
- PayloadSigner
- Handles signing and verification of envelope payloads.
-
PayloadVersionRegistry<
T> - Registry of version-specific payload decoders for a single durable DTO type.
- ProgressSignal
- Signals a task progress update.
- PrometheusMetricsExporter
- Exporter that accumulates metrics into Prometheus exposition format.
- QueueBinding
- Binding between a routing key (and optional headers) and a queue.
- QueueBroker
- Core queue operations required to publish and consume task deliveries.
- QueueDefinition
- Detailed queue definition with optional routing metadata.
- QueuePriorityRange
- Priority range constraint applied to a queue definition.
- RateLimit
- Typed rate-limit configuration shared across workers. Since: 0.3.0
- RateLimitDecision
- Result of attempting to acquire tokens from the rate limiter.
- RateLimiter
- Optional rate limiter interface shared across workers. Since: 0.1.0
- ResultBackend
- Result backend compatibility facade combining optional store capabilities. Since: 0.1.0
- RetryStrategy
- Retry strategy used to compute the next backoff delay. Since: 0.1.0
- RouteDecision
- Describes the routing decision for an enqueue request.
- RouteDefinition
- Declarative routing rule mapping match criteria to targets.
- RouteMatch
- Routing match criteria with optional task glob, headers, or queue override.
- RouteRequest
- Immutable request used when resolving routing decisions.
- RouteTarget
- Route target describing queue or broadcast destination.
- RoutingConfig
- Canonical representation of routing configuration loaded from YAML or JSON.
- RoutingInfo
- Routing metadata that accompanies published envelopes.
- RoutingRegistry
- Registry that resolves routing configuration into queue/broadcast decisions.
- RoutingSubscription
- Subscription describing the queues and broadcast channels a worker should consume from.
- ScheduleCalculator
- Computes the next run time for schedule entries.
- ScheduleEntry
- Schedule entry persisted by a Beat-like scheduler.
- ScheduleRunner
- Dispatches due ScheduleEntry records without starting a daemon.
- ScheduleSpec
- Base class for all scheduler specifications.
- ScheduleSpecKind
- Enumerates supported scheduler specification kinds.
- ScheduleStore
- Storage abstraction used by the scheduler to fetch due entries. Since: 0.1.0
- ScheduleTimezoneResolver
- Lazily resolves timezone identifiers.
- SigningConfig
- Configuration describing signing keys and behaviour.
- SolarCalculator
- Computes solar events (sunrise, sunset, solar noon) using NOAA SPA approximations.
- SolarScheduleSpec
- Schedule specification based on celestial/solar events.
- StartWorkflowRequest
- Workflow start request payload for isolate communication.
- StartWorkflowResponse
- Response payload for isolate workflow start requests.
- StartWorkflowSignal
- Request to start a workflow from an isolate.
- Stem
- Facade used by producer applications to enqueue tasks.
- StemMetrics
- Central registry that aggregates metrics before exporting them.
- StemObserver
- Observer-only task result surface.
- StemProducer
- Producer-only task enqueue surface.
-
TaskCall<
TArgs, TResult> - Represents a pending enqueue operation built from a TaskDefinition.
- TaskCancellationToken
- Cooperative cancellation state exposed to task code.
- TaskContext
- Context passed to handler implementations during execution.
-
TaskDefinition<
TArgs, TResult> - Declarative task definition to build typed enqueue calls.
- TaskEnqueueOptions
- Options that apply only to the enqueue operation.
- TaskEnqueuer
- Interface implemented by enqueuers like Stem and task contexts.
- TaskEnqueueRequest
- Enqueue request payload for isolate communication.
- TaskEnqueueResponse
- Response payload for isolate enqueue requests.
- TaskEnqueueScope
- Provides ambient metadata for task enqueue operations.
- TaskError
- Error metadata captured for failures.
- TaskExecutionContext
- Shared execution surface for task handlers and isolate entrypoints.
- TaskExecutionControl
- Runtime callbacks and optional services exposed to an executing task.
- TaskExecutionModeProvider
- Optional provider for handlers that explicitly declare their execution mode.
-
TaskHandler<
R> - Runtime task handler. Since: 0.1.0
- TaskInputContext
- Shared input surface for task execution contexts that retain invocation args.
- TaskInvocationContext
- Context exposed to task entrypoints regardless of execution environment.
- TaskInvocationSignal
- Control messages emitted by task entrypoints running inside isolates.
- TaskMetadata
- Optional task metadata for documentation and tooling.
- TaskObserver
- Observation surface for task and group lifecycle state.
- TaskOptions
- Configuration options attached to task handlers.
- TaskPayloadEncoder
- Transforms task handler results to and from backend-friendly payloads.
- TaskPayloadEncoderRegistry
- Registry for managing and resolving TaskPayloadEncoder instances.
- TaskProcessCancelled
- Task cancelled or expired.
- TaskProcessFailure
- Terminal handler failure after retry policy evaluation.
- TaskProcessor
- Processes a single envelope without owning broker delivery lifecycle.
- TaskProcessOutcome
- Semantic result of processing one task envelope.
- TaskProcessRejected
- Envelope rejected before handler execution.
- TaskProcessRetry
- Handler execution that should be attempted again later.
- TaskProcessSkipped
- Duplicate delivery skipped because a terminal status already exists.
- TaskProcessSuccess
- Successful handler execution.
- TaskPublisher
- Minimal transport contract used by producers and one-shot schedulers.
- TaskPublisherLifecycle
- Optional lifecycle capability for publishers that own disposable resources such as sockets or connection pools.
- TaskRegistrationEvent
- Event emitted when a task handler registers with a registry.
- TaskRegistry
- Registry mapping task names to handler implementations.
-
TaskResult<
T extends Object?> - Typed view over a TaskStatus returned by helpers such as Stem.waitForTask or canvas typed operations.
- TaskResultCaller
- Shared typed task-dispatch surface used by producers, apps, and contexts.
- TaskRetryPolicy
- Retry policy configuration for tasks and publish attempts.
- TaskRetryVeto
- Marker for errors whose own durable retry budget has already been exhausted.
- TaskStatus
- Canonical task record stored in the result backend.
- TaskStatusListRequest
- Query parameters used to list task status records.
- TaskStatusPage
- Paginated page of task status records.
- TaskStatusRecord
- Immutable record representing a persisted task status with timestamps.
- TaskStatusStore
- Portable task-status persistence capability.
- TaskTerminalFailureHandler
- Optional durable failure finalization for a TaskHandler.
-
TypedTaskHandler<
TArgs, TResult> - Typed task handler for the recommended manual registration path.
- WaitForWorkflowRequest
- Workflow wait request payload for isolate communication.
- WaitForWorkflowResponse
- Response payload for isolate workflow wait requests.
- WaitForWorkflowSignal
- Request to wait for a workflow from an isolate.
- WorkerHeartbeatStore
- Persistence capability for worker heartbeat state.
Enums
- BrokerDeliveryGuarantee
- Delivery guarantee advertised by a broker adapter.
- MetricType
- Known metric aggregation types supported by the exporters.
- RateLimiterFailureMode
- Defines behavior when a limiter backend call fails.
- RouteDecisionType
- Distinguishes queue vs broadcast routing decisions.
- RoutingTargetType
- Target classification for routing operations.
- SigningAlgorithm
- Supported signing algorithms.
- SolarEvent
- Supported solar events for scheduling.
- TaskCancellationReason
- Reason task processing was cancelled without executing to success.
- TaskExecutionMode
- Selects the isolate in which a task handler executes.
- TaskRecoveryPolicy
- Recovery action when a delivery still has a running status for its attempt.
- TaskRejectionReason
- Reason a task envelope was rejected before handler execution.
- TaskState
- Logical task status across enqueue, running, success, failure states.
Extensions
- BrokerCapabilitiesExtension on Broker
- Resolves capabilities without making Broker implementations add a new required member. External adapters therefore remain source-compatible and still receive a useful snapshot from the legacy getters.
- LockFencingTokenX on Lock
- Provides the fencing token when a lock implementation supports fencing.
-
NoArgsTaskDefinitionExtension
on NoArgsTaskDefinition<
TResult> - Convenience helpers for waiting on typed no-arg task definitions.
-
PayloadCodecErasedDispatch
on Codec<
T, Object?> - Adapts standard codecs to Stem's erased, nullable payload boundaries.
-
PayloadMapX
on Map<
String, Object?> - Typed read helpers for durable task-argument and workflow-parameter maps.
- QueueBrokerCapabilitiesExtension on QueueBroker
- Resolves capabilities for code that accepts the narrow QueueBroker type.
- QueueBrokerOptionalOperations on QueueBroker
- Optional operations for code that accepts the narrow QueueBroker type.
-
TaskDefinitionExtension
on TaskDefinition<
TArgs, TResult> - Convenience helpers for waiting on typed task definitions.
- TaskEnqueuerBuilderExtension on TaskEnqueuer
- Convenience helpers for building typed enqueue requests directly from a task enqueuer.
- TaskExecutionContextProgressX on TaskExecutionContext
- Shared task-progress helpers for execution contexts.
-
TaskHandlerExecutionModeX
on TaskHandler<
R> - Resolves the execution mode for a legacy or explicitly-declared handler.
- TaskInputContextArgs on TaskInputContext
- Typed read helpers for task invocation args.
- TaskStateX on TaskState
- Helpers for reasoning about task lifecycle states.
Constants
- signatureHeader → const String
- Header storing the base64 encoded payload signature.
- signatureKeyHeader → const String
- Header storing the signing key identifier used to calculate the signature.
- stemArgsEncoderHeader → const String
- Header key storing the args encoder identifier.
- stemArgsEncoderMetaKey → const String
- Metadata key storing the args encoder identifier.
- stemResultEncoderMetaKey → const String
- Metadata key storing the result encoder identifier.
Functions
-
ensureTaskPayloadEncoderRegistry(
TaskPayloadEncoderRegistry? registry, {TaskPayloadEncoder resultEncoder = const JsonTaskPayloadEncoder(), TaskPayloadEncoder argsEncoder = const JsonTaskPayloadEncoder(), Iterable< TaskPayloadEncoder> additionalEncoders = const []}) → TaskPayloadEncoderRegistry -
Ensures a TaskPayloadEncoderRegistry is available, instantiating one when
registryis null and registering anyadditionalEncoderswith whichever registry is ultimately used. -
generateEnvelopeId(
) → String - Unique identifier generator used for task envelopes by default.
Typedefs
-
TaskArgsDecoder<
TArgs> = TArgs Function(Map< String, Object?> args) - Decodes persisted task arguments into the typed handler input.
-
TaskArgsEncoder<
TArgs> = Map< String, Object?> Function(TArgs args) - Encodes strongly typed task arguments into a JSON-ready map.
-
TaskEntrypoint
= FutureOr<
Object?> Function(TaskInvocationContext context, Map<String, Object?> args) - Signature for task entrypoints that can run inside isolate executors.
-
TaskMetaBuilder<
TArgs> = Map< String, Object?> Function(TArgs args) - Builds metadata for a task invocation using its arguments.
-
TaskResultDecoder<
TResult> = TResult Function(Object? payload) - Decodes a persisted task result payload into a typed value.
Exceptions / Errors
- ScheduleConflictException
- Thrown when a schedule mutation conflicts with a newer store version.
- SignatureVerificationException
- Thrown when an envelope signature is missing or invalid.
- TaskCancellationException
- Thrown when a task cooperatively observes cancellation.
- TaskInterruptedException
- Evidence that earlier execution may have been interrupted or lost its lease.
- TaskRetryRequest
- Signals an explicit retry request from within a task handler.