Skip to main content
Version: 3.1.0 (Latest)

Java Client

Ignite 3 clients connect to the cluster via a standard socket connection. Unlike Ignite 2.x, there are no separate Thin and Thick clients in Ignite 3. All clients are 'thin'.

Clients do not become a part of the cluster topology, never hold any data, and are not used as a destination for compute calculations.

Getting Started

Prerequisites

To use Java thin client, Java 11 or newer is required.

Installation

Java client can be added to your project by using maven:

<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-client</artifactId>
<version>3.0.0</version>
</dependency>

Connecting to Cluster

To initialize a client, use the IgniteClient class, and provide it with the configuration:

try (IgniteClient client = IgniteClient.builder()
.addresses("127.0.0.1:10800")
.build()
) {
// Your code goes here
}

Authentication

To pass authentication information, use the IgniteClientAuthenticator class and pass it to IgniteClient builder:

IgniteClientAuthenticator auth = BasicAuthenticator.builder().username("myUser").password("myPassword").build();
IgniteClient.builder()
.addresses("127.0.0.1:10800")
.authenticator(auth)
.build();

Logging

To configure client logging, add loggerFactory:

IgniteClient client = IgniteClient.builder()
.addresses("127.0.0.1")
.loggerFactory(System::getLogger) // Optional: this is the default
.build();

The client logs connection errors, reconnects, and retries. By default, logging routes to java.util.logging (JUL) at INFO level.

For detailed configuration with Logback, Log4j2, or JUL, see Java Client Logging.

Client Metrics

Java

When running Java client, you need to enable metrics in the client builder:

IgniteClient client = IgniteClient.builder()
.addresses("127.0.0.1:10800")
.metricsEnabled(true)
.build();

After that, client metrics will be available to any Java monitoring tool, for example JDK Mission Control.

Available Java Metrics

Metric nameDescription
ConnectionsActiveThe number of currently active connections.
ConnectionsEstablishedThe number of established connections.
ConnectionsLostThe number of connections lost.
ConnectionsLostTimeoutThe number of connections lost due to a timeout.
HandshakesFailedThe number of failed handshakes.
HandshakesFailedTimeoutThe number of handshakes that failed due to a timeout.
RequestsActiveThe number of currently active requests.
RequestsSentThe number of requests sent.
RequestsCompletedThe number of completed requests. Requests are completed once a response is received.
RequestsRetriedThe number of request retries.
RequestsFailedThe number of failed requests.
BytesSentThe amount of bytes sent.
BytesReceivedThe amount of bytes received.
StreamerBatchesSentThe number of data streamer batches sent.
StreamerItemsSentThe number of data streamer items sent.
StreamerBatchesActiveThe number of in-flight data streamer batches.
StreamerItemsQueuedThe number of queued data streamer items.

Client Connection Configuration

There is a number of configuration properties managing the connection between the client and Ignite cluster:

IgniteClient client = IgniteClient.builder()
.addresses("127.0.0.1:10800")
.connectTimeout(5000)
.heartbeatInterval(30000)
.heartbeatTimeout(5000)
.operationTimeout(3000)
.backgroundReconnectInterval(30000)
.retryPolicy(new RetryLimitPolicy().retryLimit(8))
.build();
Configuration nameDescription
connectTimeoutClient connection timeout, in milliseconds.
heartbeatIntervalHeartbeat message interval, in milliseconds.
heartbeatTimeoutHeartbeat message timeout, in milliseconds.
operationTimeoutOperation timeout, in milliseconds.
backgroundReconnectIntervalBackground reconnect interval, in milliseconds.
retryPolicyRetry policy. By default, all read operations are retried up to 16 times, and write operations are not retried.