IDIEP-130
Author
Sponsor
Created22.11.2024
Status

ACTIVE


Motivation

Spring Boot is one of the most popular Java frameworks for creating microservices and enterprise applications. Providing seamless integration will increase Apache Ignite adoption among Spring developers and enable better integration with existing Spring Boot applications.

Description

Spring Boot auto-configuration attempts to automatically configure a Spring application based on the jar dependencies. 

In the most simple, case, ignite-client requires only Ignite address to connect to, so Ignite bean initialization requires the following steps:

  1. Adding dependency to ignite-autoconfigure module
  2. Providing ignite.addresses property via application.properties
  3. Ignite bean declaration: @Autowired IgniteClient client.

IgniteClient has the following properties:

  • String[] addresses
  • IgniteClientAddressFinder addressFinder
  • long connectTimeout
  • long reconnectThrottlingPeriod
  • int reconnectThrottlingRetries
  • long reconnectInterval
  • Executor asyncContinuationExecutor
  • long heartbeatInterval
  • long heartbeatTimeout
  • RetryPolicy retryPolicy
  • LoggerFactory loggerFactory
  • SslConfiguration sslConfiguration
  • boolean metricsEnabled
  • IgniteClientAuthenticator authenticator
  • long operationTimeout

All of the above properties must be configurable.

The suggested configuration prefix for this mode is “ignite.client”. Example of the application.properties:

ignite.client.addresses=127.0.0.1:10800
ignite.client.connectTimeout=5000
ignite.client.reconnectThrottlingPeriod=30000L


It will be also possible to set or override these properties by defining a custom configuration bean:

@Bean
public IgniteClientPropertiesCustomizer customize() {
        return cfg -> {
            cfg.setConnectTimeout(100L);
        };
}

Embedded mode

Currently, starting Apache Ignite in embedded mode requires a HOCON configuration file. This limitation is being addressed in IGNITE-22898 and must be resolved before Spring Boot integration with embedded mode can be implemented.

To run a multi-node cluster, it's required to define a node that does cluster initialization. To do that, I propose adding a property called "ignite.bootstrap.nodeName".

If "ignite.bootstrap.nodeName" is not defined, the cluster will not be automatically initialized. This approach allows for manual initialization by invoking "IgnitionManager.init()" on a specific node.

Packaging

I propose keeping autoconfigure modules along AI code in the main AI repository. This is opposite to AI2 approach, where all `extension` modules were kept in a separate repository. Keeping them in the same repository makes it easier to maintain.

When autoconfigure modules have different versions from the AI module, it becomes difficult to determine which autoconfigure version to use. While the autoconfigure module itself typically doesn't undergo major changes between versions, other Spring modules, such as Spring Data, do.

Example of ignite configuring with same as AI versioning:

dependencies {
    implementation 'org.apache.ignite:ignite-autoconfigure:3.0.0'
    implementation 'org.apache.ignite:ignite-api:3.0.0'
    implementation 'org.apache.ignite:ignite-runner:3.0.0'
}

The same for client:

dependencies {
    implementation 'org.apache.ignite:ignite-client-autoconfigure:3.0.0'
    implementation 'org.apache.ignite:ignite-client:3.0.0'
}

Discussion Links

Reference Links

// Links to various reference documents, if applicable.

Tickets

// Links or report with relevant JIRA tickets.

  • No labels