MongoDB Starter
Dependency
The following dependency is provided by default for flo-based projects (created using the Scaffolder)
<dependency>
<groupId>com.iconsolutions.ipf.core.platform</groupId>
<artifactId>ipf-common-starter-mongo</artifactId>
</dependency>
If you’re developing your own project using MongoDB as a data store and using Spring Reactive, you can include the above dependency to provide enhanced MongoDB integration.
Doing so adds:
-
Retries
-
SSL Configuration
-
Additional Converters
This page outlines the various different configuration options for the functionality provided by the above dependency.
Retries
When using the MongoDB Starter, the default retry configuration below helps handle transient failures (like network issues or rate limits) in Spring Data Reactive Repositories and can be customised as required.
| Config | Type | Comment | Default |
|---|---|---|---|
|
Integer |
Maximum number of retry attempts if error code is contained in the list of |
|
|
List of Integers |
Comma separated list of error codes for which retries should be attempted |
|
|
Duration |
Delay until the next retry attempt, specified as a duration. For more details on the supported format, see: github.com/lightbend/config/blob/main/HOCON.md#duration-format |
|
SSL Configuration
If securing a connection to MongoDB server, this can be done by setting the below configuration.
| Config | Type | Comment | Default | ||
|---|---|---|---|---|---|
|
Boolean |
Configure the SSL context based on the below configuration parameters |
|
||
|
String |
File path or resource location of the keystore file for MongoDB SSL/TLS connections |
|
||
|
String |
Password required to access the keystore defined by
|
|
||
|
String |
The type of the keystore defined by |
|
||
|
String |
Specifies the password required to access the private key within the keystore.
|
|
||
|
String |
File path or resource location of the trust store used to establish trust for SSL/TLS connections to MongoDB |
|
||
|
String |
The type of the truststore defined by |
|
||
|
String |
Password to access the trust store file.
|
|
Additional Converters
The following additional converters are registered as MongoCustomConversions with Spring Data when adding the ipf-common-starter-mongo dependency:
| Converter | Conversion |
|---|---|
Decimal128ToBigDecimalConverter |
|
BigDecimalToDecimal128Converter |
|
DateToOffsetDateTimeConverter |
|
OffsetDateTimeToDateConverter |
|
DateToIsoDateTimeConverter |
|
IsoDateTimeToStringConverter |
|
StringToIsoDateTimeConverter |
|
CommandIdToStringConverter |
|
StringToCommandIdConverter |
|
SupportingContextToStringConverter |
|
StringToSupportingContextConverter |
|