Skip to content

Conversation

@christophstrobl
Copy link
Member

We now offer a fluent API for more intuitive change stream interaction.

Flux<ChangeStreamEvent<User>> flux = reactiveTemplate.changeStream()
    .watchCollection("persons")
    .filter(where("age").gte(38))
    .as(User.class)
    .listen();

Copy link
Member

@mp911de mp911de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add Kotlin extensions for reified generics and for the as -> asType method.

*
* @return new instance of {@link ReactiveFind}. Never {@literal null}.
*/
ReactiveChangeStream<Document> changeStream();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we drop this method in favor of changeStream(Document.class)?

* @see ChangeStreamOptionsBuilder#resumeAt(BsonTimestamp)
* @throws IllegalArgumentException if the given beacon is neither {@link Instant} nor {@link BsonTimestamp}.
*/
TerminatingChangeStream<T> resumeAt(Object beacon);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: token, not beacon.

* Consider limiting events be defining a {@link ChangeStreamWithCollection#watchCollection(String) collection} and/or
* {@link ChangeStreamWithFilter#filter(CriteriaDefinition) filter}.
*
* @return new instance of {@link ReactiveFind}. Never {@literal null}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: ReactiveChangeStream instead of ReactiveFind.

/**
* Result type override (optional).
*/
interface ChangeStreamWithProjection<T> extends ChangeStreamWithFilter<T> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we should inline this interface into ChangeStreamWithFilter. ChangeStreamWithFilter.filter returns ChangeStreamWithProjection and as(…) returns ChangeStreamWithFilter.

We now offer a fluent API for more intuitive change stream interaction.

Flux<ChangeStreamEvent<User>> flux = reactiveTemplate.changeStream()
    .watchCollection("persons")
    .filter(where("age").gte(38))
    .as(User.class)
    .listen();
mp911de pushed a commit that referenced this pull request Jul 3, 2019
We now offer a fluent API for more intuitive change stream interaction.

Flux<ChangeStreamEvent<User>> flux = reactiveTemplate.changeStream(User.class)
    .watchCollection("people")
    .filter(where("age").gte(38))
    .listen();

Original pull request: #751.
mp911de added a commit that referenced this pull request Jul 3, 2019
Add watchCollection(…) accepting an entity class. Use static import for assertions. Tweak javadoc.

Original pull request: #751.
@mp911de
Copy link
Member

mp911de commented Jul 3, 2019

That's merged and polished now.

@mp911de mp911de closed this Jul 3, 2019
@mp911de mp911de deleted the issue/DATAMONGO-2089 branch July 3, 2019 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants