public static class DefaultMongoTemplate.Builder extends AbstractMongoTemplate.Builder
DefaultMongoTemplate.
The domainEventsCollectionName, snapshotEventsCollectionName, trackingTokensCollectionName and (@code sagasCollectionName} are respectively defaulted to trackingtokens, domainevents, snapshotevents and sagas.
The MongoDatabase is a hard requirement and as such should be provided. Can either be provided
directly, or by setting a MongoClient. When choosing the latter approach, the MongoDatabase name can be
specified by using the mongoDatabase(MongoClient, String) function. Otherwise, the database name
defaults to AbstractMongoTemplate.Builder#DEFAULT_AXONFRAMEWORK_DATABASE
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
DefaultMongoTemplate |
build()
Initializes a
DefaultMongoTemplate as specified through this Builder. |
DefaultMongoTemplate.Builder |
domainEventsCollectionName(String domainEventsCollectionName)
Sets the
domainEventsCollectionName to use as the collection name for Domain Events. |
DefaultMongoTemplate.Builder |
mongoDatabase(com.mongodb.client.MongoClient mongoClient)
Sets the
MongoDatabase by means of providing a MongoClient. |
DefaultMongoTemplate.Builder |
mongoDatabase(com.mongodb.client.MongoClient mongoClient,
String databaseName)
Sets the
MongoDatabase by means of providing a MongoClient. |
DefaultMongoTemplate.Builder |
mongoDatabase(com.mongodb.client.MongoDatabase mongoDatabase)
Sets the
MongoDatabase used by this template to connect to a Mongo instance. |
DefaultMongoTemplate.Builder |
sagasCollectionName(String sagasCollectionName)
Sets the
sagasCollectionName to use as the collection name for Saga instances. |
DefaultMongoTemplate.Builder |
snapshotEventsCollectionName(String snapshotEventsCollectionName)
Sets the
snapshotEventsCollectionName to use as the collection name for Snapshot Events. |
DefaultMongoTemplate.Builder |
trackingTokensCollectionName(String trackingTokensCollectionName)
Sets the
trackingTokensCollectionName to use as the collection name for Tracking Tokens. |
validatepublic DefaultMongoTemplate.Builder mongoDatabase(com.mongodb.client.MongoClient mongoClient)
AbstractMongoTemplate.BuilderMongoDatabase by means of providing a MongoClient. The MongoClient.getDatabase(String) function is in turn used to retrieve the MongoDatabase, using AbstractMongoTemplate.Builder.DEFAULT_AXONFRAMEWORK_DATABASE as the database name.mongoDatabase in class AbstractMongoTemplate.BuildermongoClient - the MongoClient used to retrieve a MongoDatabase frompublic DefaultMongoTemplate.Builder mongoDatabase(com.mongodb.client.MongoClient mongoClient, String databaseName)
AbstractMongoTemplate.BuilderMongoDatabase by means of providing a MongoClient. The MongoClient.getDatabase(String) function is in turn used to retrieve the MongoDatabase using databaseName as the database name.mongoDatabase in class AbstractMongoTemplate.BuildermongoClient - the MongoClient used to retrieve a MongoDatabase fromdatabaseName - a String denoting the name of the MongoDatabasepublic DefaultMongoTemplate.Builder mongoDatabase(com.mongodb.client.MongoDatabase mongoDatabase)
AbstractMongoTemplate.BuilderMongoDatabase used by this template to connect to a Mongo instance.mongoDatabase in class AbstractMongoTemplate.BuildermongoDatabase - the MongoDatabase used by this template to connect to a Mongo instancepublic DefaultMongoTemplate.Builder domainEventsCollectionName(String domainEventsCollectionName)
domainEventsCollectionName to use as the collection name for Domain Events. Defaults to a
"domainevents" String.domainEventsCollectionName - a String specifying the collection name for Domain Eventspublic DefaultMongoTemplate.Builder snapshotEventsCollectionName(String snapshotEventsCollectionName)
snapshotEventsCollectionName to use as the collection name for Snapshot Events. Defaults to
a "snapshotevents" String.snapshotEventsCollectionName - a String specifying the collection name for Snapshot Eventspublic DefaultMongoTemplate.Builder trackingTokensCollectionName(String trackingTokensCollectionName)
trackingTokensCollectionName to use as the collection name for Tracking Tokens. Defaults to
a "trackingtokens" String.trackingTokensCollectionName - a String specifying the collection name for Tracking Tokenspublic DefaultMongoTemplate.Builder sagasCollectionName(String sagasCollectionName)
sagasCollectionName to use as the collection name for Saga instances. Defaults to a "sagas" String.sagasCollectionName - a String specifying the collection name for Sagaspublic DefaultMongoTemplate build()
DefaultMongoTemplate as specified through this Builder.DefaultMongoTemplate as specified through this BuilderCopyright © 2010–2022. All rights reserved.