Skip to content

Commit dbd2de8

Browse files
mp911dechristophstrobl
authored andcommitted
DATAMONGO-1818 - Reword tailable cursors documentation.
Fix reference to @Tailable annotation. Slightly reword documentation. Original Pull Request: spring-projects#512
1 parent 0dbe331 commit dbd2de8

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/main/asciidoc/reference/reactive-mongo-repositories.adoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,11 @@ public interface PersonRepository extends ReactiveMongoRepository<Person, String
190190
[[mongo.reactive.repositories.infinite-streams]]
191191
== Infinite Streams with Tailable Cursors
192192

193-
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.
193+
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.
194194

195-
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.
195+
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.
196+
197+
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.
196198

197199
[source,java]
198200
----
@@ -210,6 +212,6 @@ Disposable subscription = stream.doOnNext(System.out::println).subscribe();
210212
211213
// …
212214
213-
// Later: Dispose the stream
215+
// Later: Dispose the subscription to close the stream
214216
subscription.dispose();
215217
----

src/main/asciidoc/reference/reactive-mongodb.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,9 @@ The query syntax used in the example is explained in more detail in the section
460460
[[mongo.reactive.tailcursors]]
461461
== Infinite Streams
462462

463-
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.
463+
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.
464+
465+
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.
464466

465467
[source,java]
466468
----
@@ -470,11 +472,10 @@ Disposable subscription = stream.doOnNext(person -> System.out.println(person)).
470472
471473
// …
472474
473-
// Later: Dispose the stream
475+
// Later: Dispose the subscription to close the stream
474476
subscription.dispose();
475477
----
476478

477-
478479
[[mongo.reactive.executioncallback]]
479480
== Execution callbacks
480481

0 commit comments

Comments
 (0)