
com.mongodb.reactivestreams.client.ChangeStreamPublisher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongodb-driver-reactivestreams
Show all versions of mongodb-driver-reactivestreams
A Reactive Streams implementation of the MongoDB Java driver
/*
* Copyright 2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.mongodb.reactivestreams.client;
import com.mongodb.client.model.Collation;
import com.mongodb.client.model.changestream.ChangeStreamDocument;
import com.mongodb.client.model.changestream.FullDocument;
import org.bson.BsonDocument;
import org.bson.BsonTimestamp;
import org.reactivestreams.Publisher;
import java.util.concurrent.TimeUnit;
/**
* Iterable for change streams.
*
* @param The type of the result.
* @mongodb.server.release 3.6
* @since 1.6
*/
public interface ChangeStreamPublisher extends Publisher> {
/**
* Sets the fullDocument value.
*
* @param fullDocument the fullDocument
* @return this
*/
ChangeStreamPublisher fullDocument(FullDocument fullDocument);
/**
* Sets the logical starting point for the new change stream.
*
* @param resumeToken the resume token
* @return this
*/
ChangeStreamPublisher resumeAfter(BsonDocument resumeToken);
/**
* The change stream will only provide changes that occurred after the specified timestamp.
*
* Any command run against the server will return an operation time that can be used here.
* The default value is an operation time obtained from the server before the change stream was created.
*
* @param startAtOperationTime the start at operation time
* @since 1.9
* @return this
* @mongodb.server.release 4.0
* @mongodb.driver.manual reference/method/db.runCommand/
*/
ChangeStreamPublisher startAtOperationTime(BsonTimestamp startAtOperationTime);
/**
* Sets the maximum await execution time on the server for this operation.
*
* @param maxAwaitTime the max await time. A zero value will be ignored, and indicates that the driver should respect the server's
* default value
* @param timeUnit the time unit, which may not be null
* @return this
*/
ChangeStreamPublisher maxAwaitTime(long maxAwaitTime, TimeUnit timeUnit);
/**
* Sets the collation options
*
* A null value represents the server default.
* @param collation the collation options to use
* @return this
*/
ChangeStreamPublisher collation(Collation collation);
/**
* Returns a {@code MongoIterable} containing the results of the change stream based on the document class provided.
*
* @param clazz the class to use for the raw result.
* @param the result type
* @return the new Mongo Iterable
*/
Publisher withDocumentClass(Class clazz);
/**
* Sets the number of documents to return per batch.
*
* Overrides the {@link org.reactivestreams.Subscription#request(long)} value for setting the batch size, allowing for fine grained
* control over the underlying cursor.
*
* @param batchSize the batch size
* @return this
* @since 1.8
* @mongodb.driver.manual reference/method/cursor.batchSize/#cursor.batchSize Batch Size
*/
ChangeStreamPublisher batchSize(int batchSize);
/**
* Helper to return a publisher limited to the first result.
*
* @return a Publisher which will contain a single item.
* @since 1.8
*/
Publisher> first();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy