DATAMONGO-1818 - Reword tailable cursors documentation.
Fix reference to @Tailable annotation. Slightly reword documentation. Original Pull Request: #512
This commit is contained in:
committed by
Christoph Strobl
parent
0dbe331ab0
commit
dbd2de8e0f
@@ -190,9 +190,11 @@ public interface PersonRepository extends ReactiveMongoRepository<Person, String
|
||||
[[mongo.reactive.repositories.infinite-streams]]
|
||||
== Infinite Streams with Tailable Cursors
|
||||
|
||||
By default, MongoDB will automatically close a cursor when the client has exhausted all results in the cursor. Closing a cursors turns a Stream into a finite stream. However, for capped collections you may use a https://docs.mongodb.com/manual/core/tailable-cursors/[Tailable Cursor] that remains open after the client exhausts the results in the initial cursor. Using tailable Cursors with a reactive approach allows construction of infinite streams. A tailable Cursor remains open until it's closed. It emits data as data arrives in a capped collection. Using Tailable Cursors with Collections is not possible as its result would never complete.
|
||||
By default, MongoDB will automatically close a cursor when the client exhausts all results supplied by the cursor. Closing a cursor on exhaustion turns a stream into a finite stream. For capped collections, you may use a https://docs.mongodb.com/manual/core/tailable-cursors/[Tailable Cursor] that remains open after the client consumes all initially returned data. Using tailable cursors with a reactive data types allows construction of infinite streams. A tailable cursor remains open until it's closed externally. It emits data as new documents arrive in a capped collection.
|
||||
|
||||
Spring Data MongoDB Reactive Repository support supports infinite streams by annotating a query method with `@TailableCursor`. This works for methods returning `Flux` or `Observable` wrapper types.
|
||||
Tailable cursors may become dead, or invalid, if either the query returns no match or the cursor returns the document at the "end" of the collection and then the application deletes that document.
|
||||
|
||||
Spring Data MongoDB Reactive repositories support infinite streams by annotating a query method with `@Tailable`. This works for methods returning `Flux` or other reactive types capable of emitting multiple elements.
|
||||
|
||||
[source,java]
|
||||
----
|
||||
@@ -210,6 +212,6 @@ Disposable subscription = stream.doOnNext(System.out::println).subscribe();
|
||||
|
||||
// …
|
||||
|
||||
// Later: Dispose the stream
|
||||
// Later: Dispose the subscription to close the stream
|
||||
subscription.dispose();
|
||||
----
|
||||
|
||||
@@ -460,7 +460,9 @@ The query syntax used in the example is explained in more detail in the section
|
||||
[[mongo.reactive.tailcursors]]
|
||||
== Infinite Streams
|
||||
|
||||
By default, MongoDB will automatically close a cursor when the client has exhausted all results in the cursor. Closing a cursors turns a Stream into a finite stream. However, for capped collections you may use a https://docs.mongodb.com/manual/core/tailable-cursors/[Tailable Cursor] that remains open after the client exhausts the results in the initial cursor. Using Tailable Cursors with a reactive approach allows construction of infinite streams. A Tailable Cursor remains open until it's closed. It emits data as data arrives in a capped collection. Using Tailable Cursors with Collections is not possible as its result would never complete.
|
||||
By default, MongoDB will automatically close a cursor when the client exhausts all results supplied by the cursor. Closing a cursor on exhaustion turns a stream into a finite stream. For capped collections, you may use a https://docs.mongodb.com/manual/core/tailable-cursors/[Tailable Cursor] that remains open after the client consumes all initially returned data. Using tailable cursors with a reactive data types allows construction of infinite streams. A tailable cursor remains open until it's closed externally. It emits data as new documents arrive in a capped collection.
|
||||
|
||||
Tailable cursors may become dead, or invalid, if either the query returns no match or the cursor returns the document at the "end" of the collection and then the application deletes that document.
|
||||
|
||||
[source,java]
|
||||
----
|
||||
@@ -470,11 +472,10 @@ Disposable subscription = stream.doOnNext(person -> System.out.println(person)).
|
||||
|
||||
// …
|
||||
|
||||
// Later: Dispose the stream
|
||||
// Later: Dispose the subscription to close the stream
|
||||
subscription.dispose();
|
||||
----
|
||||
|
||||
|
||||
[[mongo.reactive.executioncallback]]
|
||||
== Execution callbacks
|
||||
|
||||
|
||||
Reference in New Issue
Block a user