Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Clarify atLeastOnceFlow filter #1270

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/src/main/paradox/dynamodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ A good alternative for advanced state management is to implement the handler as
An Akka Streams `FlowWithContext` can be used instead of a handler for processing the envelopes, which is described in
@ref:[Processing with Akka Streams](flow.md).

In addition to the caveats described there a `DynamoDBProjection.atLeastOnceFlow` must not filter out envelopes. Always
emit a `Done` element for each completed envelope, even if application processing was skipped for the envelope.

### Handler lifecycle

You can override the `start` and `stop` methods of the @apidoc[Handler] or @apidoc[DynamoDBTransactHandler] to
Expand Down
3 changes: 2 additions & 1 deletion docs/src/main/paradox/flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ from previously stored offset some envelopes may be processed more than once.
There are a few caveats to be aware of:

* If the flow filters out envelopes the corresponding offset will not be stored, and such an envelope
will be processed again if the projection is restarted and no later offset was stored.
will be processed again if the projection is restarted and no later offset was stored. Instead of filter it
is better to skip the processing but still emit the `Done` element.
* The flow should not duplicate emitted envelopes (`mapConcat`) with same offset, because then it can result in
that the first offset is stored and when the projection is restarted that offset is considered completed even
though more of the duplicated envelopes were never processed.
Expand Down
5 changes: 4 additions & 1 deletion docs/src/main/paradox/r2dbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ A good alternative for advanced state management is to implement the handler as
An Akka Streams `FlowWithContext` can be used instead of a handler for processing the envelopes,
which is described in @ref:[Processing with Akka Streams](flow.md).

In addition to the caveats described there a `R2dbcProjection.atLeastOnceFlow` must not filter out envelopes. Always
emit a `Done` element for each completed envelope, even if application processing was skipped for the envelope.

### Handler lifecycle

You can override the `start` and `stop` methods of the `R2dbcHandler` to implement initialization
Expand Down Expand Up @@ -319,4 +322,4 @@ Scala
: @@snip [Example.scala](/akka-projection-r2dbc/src/test/scala/docs/home/projection/R2dbcProjectionDocExample.scala){#customConnectionFactory}

Java
: @@snip [Example.java](/akka-projection-r2dbc/src/test/java/jdocs/home/projection/R2dbcProjectionDocExample.java){#customConnectionFactory}
: @@snip [Example.java](/akka-projection-r2dbc/src/test/java/jdocs/home/projection/R2dbcProjectionDocExample.java){#customConnectionFactory}
Loading