From 686cdac73f4f7e63372c09414f4503e2fdce8f08 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Thu, 19 Sep 2019 10:23:51 +0200 Subject: [PATCH] DATAMONGO-2366 - Polishing. Fix typo in reference documentation and add note on error handling. Original Pull Request: #790 --- src/main/asciidoc/reference/change-streams.adoc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/asciidoc/reference/change-streams.adoc b/src/main/asciidoc/reference/change-streams.adoc index a31aad2a4..885c6201c 100644 --- a/src/main/asciidoc/reference/change-streams.adoc +++ b/src/main/asciidoc/reference/change-streams.adoc @@ -36,13 +36,19 @@ Subscription subscription = container.register(new ChangeStreamRequest<>(listene container.stop(); <5> ---- -<1> Starting the container intializes the resources and starts `Task` instances for already registered `SubscriptionRequest` instances. Requests added after startup are ran immediately. +<1> Starting the container initializes the resources and starts `Task` instances for already registered `SubscriptionRequest` instances. Requests added after startup are ran immediately. <2> Define the listener called when a `Message` is received. The `Message#getBody()` is converted to the requested domain type. Use `Document` to receive raw results without conversion. <3> Set the collection to listen to and provide additional options through `ChangeStreamOptions`. <4> Register the request. The returned `Subscription` can be used to check the current `Task` state and cancel its execution to free resources. <5> Do not forget to stop the container once you are sure you no longer need it. Doing so stops all running `Task` instances within the container. ==== +[NOTE] +==== +Errors while processing are passed on to an `org.springframework.util.ErrorHandler`. If not stated otherwise a log appending `ErrorHandler` gets applied by default. + +Please use `register(request, body, errorHandler)` to provide additional functionality. +==== + === Reactive Change Streams Subscribing to Change Streams with the reactive API is a more natural approach to work with streams. Still, the essential building blocks, such as `ChangeStreamOptions`, remain the same. The following example shows how to use Change Streams emitting ``ChangeStreamEvent``s: