Class ChangeStreamRequest.ChangeStreamRequestBuilder<T>
java.lang.Object
org.springframework.data.mongodb.core.messaging.ChangeStreamRequest.ChangeStreamRequestBuilder<T>
- Enclosing class:
- ChangeStreamRequest<T>
Builder for creating
ChangeStreamRequest
.- Since:
- 2.1
- Author:
- Christoph Strobl
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Set the collation to use.collection
(String collectionName) Set the name of theMongoCollection
to listen to.Set the name of theMongoDatabase
to listen to.filter
(org.bson.Document... pipeline) Set the plain filter chain to apply.filter
(Aggregation aggregation) Set the filter to apply.fullDocumentBeforeChangeLookup
(com.mongodb.client.model.changestream.FullDocumentBeforeChange lookup) Set theFullDocumentBeforeChange
lookup to the given value.fullDocumentLookup
(com.mongodb.client.model.changestream.FullDocument lookup) Set theFullDocument
lookup toFullDocument.UPDATE_LOOKUP
.maxAwaitTime
(Duration timeout) Set the cursors maximum wait time on the server (for a new Document to be emitted).publishTo
(MessageListener<com.mongodb.client.model.changestream.ChangeStreamDocument<org.bson.Document>, ? super T> messageListener) Set theMessageListener
eventmessages
will be published to.resumeAfter
(org.bson.BsonValue resumeToken) Set the resume token after which to continue emitting notifications.Set the cluster time at which to resume listening.resumeToken
(org.bson.BsonValue resumeToken) Set the resume token (typically aBsonDocument
containing abinary token
) after which to start with listening.startAfter
(org.bson.BsonValue resumeToken) Set the resume token after which to start emitting notifications.
-
Method Details
-
database
Set the name of theMongoDatabase
to listen to.- Parameters:
databaseName
- must not be null nor empty.- Returns:
- this.
-
collection
Set the name of theMongoCollection
to listen to.- Parameters:
collectionName
- must not be null nor empty.- Returns:
- this.
-
publishTo
public ChangeStreamRequest.ChangeStreamRequestBuilder<T> publishTo(MessageListener<com.mongodb.client.model.changestream.ChangeStreamDocument<org.bson.Document>, ? super T> messageListener) Set theMessageListener
eventmessages
will be published to.- Parameters:
messageListener
- must not be null.- Returns:
- this.
-
filter
Set the filter to apply.
Fields on aggregation expression root level are prefixed to map to fields contained infullDocument
. However operationType, ns, documentKey and fullDocument are reserved words that will be omitted, and therefore taken as given, during the mapping procedure. You may want to have a look at the structure of Change Events.
UseTypedAggregation
to ensure filter expressions are mapped to domain type fields.- Parameters:
aggregation
- theAggregation pipeline
to apply for filtering events. Must not be null.- Returns:
- this.
- See Also:
-
filter
Set the plain filter chain to apply.- Parameters:
pipeline
- must not be null nor contain null values.- Returns:
- this.
- See Also:
-
collation
Set the collation to use.- Parameters:
collation
- must not be null nor empty.- Returns:
- this.
- See Also:
-
resumeToken
public ChangeStreamRequest.ChangeStreamRequestBuilder<T> resumeToken(org.bson.BsonValue resumeToken) Set the resume token (typically aBsonDocument
containing abinary token
) after which to start with listening.- Parameters:
resumeToken
- must not be null.- Returns:
- this.
- See Also:
-
resumeAt
Set the cluster time at which to resume listening.- Parameters:
clusterTime
- must not be null.- Returns:
- this.
- See Also:
-
resumeAfter
public ChangeStreamRequest.ChangeStreamRequestBuilder<T> resumeAfter(org.bson.BsonValue resumeToken) Set the resume token after which to continue emitting notifications.- Parameters:
resumeToken
- must not be null.- Returns:
- this.
- Since:
- 2.2
-
startAfter
Set the resume token after which to start emitting notifications.- Parameters:
resumeToken
- must not be null.- Returns:
- this.
- Since:
- 2.2
-
fullDocumentLookup
public ChangeStreamRequest.ChangeStreamRequestBuilder<T> fullDocumentLookup(com.mongodb.client.model.changestream.FullDocument lookup) Set theFullDocument
lookup toFullDocument.UPDATE_LOOKUP
. -
fullDocumentBeforeChangeLookup
public ChangeStreamRequest.ChangeStreamRequestBuilder<T> fullDocumentBeforeChangeLookup(com.mongodb.client.model.changestream.FullDocumentBeforeChange lookup) Set theFullDocumentBeforeChange
lookup to the given value. -
maxAwaitTime
Set the cursors maximum wait time on the server (for a new Document to be emitted).- Parameters:
timeout
- must not be null.- Since:
- 3.0
-
build
- Returns:
- the build
ChangeStreamRequest
.
-