Overview
Theio.flowwarden.stream.registration package (since 1.0.0-rc.6) declares Change Streams without annotations. A StreamDefinitionContributor bean is called once at bootstrap with a StreamRegistration; each registration.stream(name, documentType) call opens a StreamSpec.Builder. The resulting StreamSpec is immutable and is converted internally to the same definition an annotated class produces.
For the motivation and worked examples, see the Programmatic Registration guide.
Bootstrap-only. Contributors run after all singleton beans are created and before any stream starts. There is no API to add or remove a stream on a running instance.
StreamDefinitionContributor
contribute runs exactly once. A duplicate stream name across contributors or against an annotated stream fails startup.
StreamRegistration
StreamSpec.Builder<T>
Target and behaviour
Handlers
One handler per operation type; a second registration for the same operation throwsIllegalStateException.
The handler interfaces live in
io.flowwarden.stream.core. Imperative handlers on a reactive stream (or the reverse) are rejected at bootstrap.
Pipeline, filter, errors
ErrorHandler (in io.flowwarden.stream.core):
ErrorAction semantics are those of @OnError. A handler that throws falls back to RETHROW.
Policies
Spec types
Each spec type is an immutable value with abuilder() and a defaults() factory. defaults() returns exactly the annotation’s default attribute values.
CheckpointSpec
CheckpointSpec
See
@Checkpoint for the semantics and bounds.RetryPolicySpec
RetryPolicySpec
See
@RetryPolicy.DeadLetterQueueSpec
DeadLetterQueueSpec
See
@DeadLetterQueue.MongoDlqOptionsSpec
MongoDlqOptionsSpec
StreamSpec<T> accessors
The built spec exposes what was declared, read-only: name(), documentType(), collection(), database(), enabled(), autoStart(), fullDocument(), fullDocumentBeforeChange(), deploymentMode(), mongoTemplateRef(), checkpoint(), retryPolicy(), deadLetterQueue(), mongoDlqOptions(), handler(OperationType), typedHandlers(), onChangeHandler(), pipeline(), filter(), errorHandlers(). Optional-valued where the annotation attribute is optional; collections are defensive copies.
Not covered
zone— no builder method yet. A stream needing a zone stays annotated.- Hot registration — contributions are fixed for the lifetime of the context.
Validation
Contributed streams go through the validator shared with the annotation path. Any violation — checkpoint/retry/DLQ bounds, collection resolution,mongoTemplateRef type, handler mode, filter compatibility, duplicate onError claims, duplicate stream name — fails application startup with the same messages an annotated class would produce.