public static class MongoTokenStore.Builder extends Object
MongoTokenStore.
The claimTimeout is defaulted to a 10 seconds duration (by using Duration.ofSeconds(long), nodeId is defaulted to the ManagementFactory#getRuntimeMXBean#getName output, the contentType to
a byte[] Class, and the ensureIndexes to true. The MongoTemplate and
Serializer are hard requirements and as such should be provided.
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
MongoTokenStore |
build()
Initializes a
MongoTokenStore as specified through this Builder. |
MongoTokenStore.Builder |
claimTimeout(TemporalAmount claimTimeout)
Sets the
claimTimeout specifying the amount of time this process will wait after which this process
will force a claim of a TrackingToken. |
MongoTokenStore.Builder |
contentType(Class<?> contentType)
Sets the
contentType to which a TrackingToken should be serialized. |
MongoTokenStore.Builder |
ensureIndexes(boolean ensureIndexes)
Sets the
ensureIndexes to tell the builder whether to create or not the indexes required to work with
the TokenStore. |
MongoTokenStore.Builder |
mongoTemplate(MongoTemplate mongoTemplate)
Sets the
MongoTemplate providing access to the collection which stores the TrackingTokens. |
MongoTokenStore.Builder |
nodeId(String nodeId)
Sets the
nodeId to identify ownership of the tokens. |
MongoTokenStore.Builder |
serializer(org.axonframework.serialization.Serializer serializer)
Sets the
Serializer used to de-/serialize TrackingTokens with. |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public MongoTokenStore.Builder mongoTemplate(MongoTemplate mongoTemplate)
MongoTemplate providing access to the collection which stores the TrackingTokens.mongoTemplate - the MongoTemplate providing access to the collection which stores the TrackingTokenspublic MongoTokenStore.Builder serializer(org.axonframework.serialization.Serializer serializer)
Serializer used to de-/serialize TrackingTokens with.serializer - a Serializer used to de-/serialize TrackingTokens withpublic MongoTokenStore.Builder claimTimeout(TemporalAmount claimTimeout)
claimTimeout specifying the amount of time this process will wait after which this process
will force a claim of a TrackingToken. Thus if a claim has not been updated for the given claimTimeout, this process will 'steal' the claim. Defaults to a duration of 10 seconds.claimTimeout - a timeout specifying the time after which this process will force a claimpublic MongoTokenStore.Builder nodeId(String nodeId)
nodeId to identify ownership of the tokens. Defaults to ManagementFactory#getRuntimeMXBean#getName output as the node id.nodeId - the id as a String to identify ownership of the tokenspublic MongoTokenStore.Builder contentType(Class<?> contentType)
contentType to which a TrackingToken should be serialized. Defaults to a byte[] Class type.contentType - the content type as a Class to which a TrackingToken should be serializedpublic MongoTokenStore.Builder ensureIndexes(boolean ensureIndexes)
ensureIndexes to tell the builder whether to create or not the indexes required to work with
the TokenStore. Defaults to true. If set to false, the developer is responsible for the
creation of the indexes defined in the MongoTokenStore.ensureIndexes() method beforehand.ensureIndexes - the boolean to indicate if the indexes should be created.public MongoTokenStore build()
MongoTokenStore as specified through this Builder.MongoTokenStore as specified through this Builderprotected void validate()
throws org.axonframework.common.AxonConfigurationException
org.axonframework.common.AxonConfigurationException - if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2022. All rights reserved.