Package com.hazelcast.jet.mongodb
Class MongoSourceBuilder.Stream<T>
- java.lang.Object
-
- com.hazelcast.jet.mongodb.MongoSourceBuilder.Stream<T>
-
- Type Parameters:
T
- type of the queried documents
- Enclosing class:
- MongoSourceBuilder
public static final class MongoSourceBuilder.Stream<T> extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StreamSource<T>
build()
Creates and returns the MongoDBStreamSource
which watches the given collection.MongoSourceBuilder.Stream<org.bson.Document>
collection(java.lang.String collectionName)
Specifies from which collection connector will read documents.<T_NEW> MongoSourceBuilder.Stream<T_NEW>
collection(java.lang.String collectionName, java.lang.Class<T_NEW> mongoType)
Specifies from which collection connector will read documents.<T_NEW> MongoSourceBuilder.Stream<T_NEW>
mapFn(BiFunctionEx<com.mongodb.client.model.changestream.ChangeStreamDocument<org.bson.Document>,java.lang.Long,T_NEW> mapFn)
MongoSourceBuilder.Stream<T>
startAtOperationTime(org.bson.BsonTimestamp startAtOperationTime)
Specifies time from which MongoDB's events will be read.
-
-
-
Method Detail
-
collection
@Nonnull public MongoSourceBuilder.Stream<org.bson.Document> collection(@Nonnull java.lang.String collectionName)
Specifies from which collection connector will read documents. If not invoked, then connector will look at all collections in given database.Example usage:
This function is an equivalent of calling collection(String, Class) with Document as the second argument.MongoSourceBuilder.stream(name, supplier) .collection("myCollection");
- Parameters:
collectionName
- Name of the collection that will be queried.- Returns:
- this builder
-
collection
@Nonnull public <T_NEW> MongoSourceBuilder.Stream<T_NEW> collection(@Nonnull java.lang.String collectionName, @Nonnull java.lang.Class<T_NEW> mongoType)
Specifies from which collection connector will read documents. If not invoked, then connector will look at all collections in given database. All documents read will be automatically parsed to user-defined type using MongoDB's standard codec registry with pojo support added.Example usage:
This function is an equivalent for calling:MongoSourceBuilder.stream(name, supplier) .collection("myCollection", MyDocumentPojo.class);
import static com.hazelcast.jet.mongodb.impl.Mappers.toClass; MongoSourceBuilder.stream(name, supplier) .collection("myCollection") .mapFn(toClass(MyuDocumentPojo.class));
- Parameters:
collectionName
- Name of the collection that will be queried.mongoType
- user defined type to which the document will be parsed.- Returns:
- this builder
-
mapFn
@Nonnull public <T_NEW> MongoSourceBuilder.Stream<T_NEW> mapFn(@Nonnull BiFunctionEx<com.mongodb.client.model.changestream.ChangeStreamDocument<org.bson.Document>,java.lang.Long,T_NEW> mapFn)
- Type Parameters:
T_NEW
- type of the emitted object- Parameters:
mapFn
- transforms the queried document to the desired output object. Second parameter will be the event timestamp.- Returns:
- this builder
-
startAtOperationTime
@Nonnull public MongoSourceBuilder.Stream<T> startAtOperationTime(@Nonnull org.bson.BsonTimestamp startAtOperationTime)
Specifies time from which MongoDB's events will be read.It is highly suggested to provide this argument, as it will reduce reading initial state of database.
- Parameters:
startAtOperationTime
- time from which events should be taken into consideration- Returns:
- this builder
-
build
@Nonnull public StreamSource<T> build()
Creates and returns the MongoDBStreamSource
which watches the given collection.
-
-