Connection Group
InstanceConnectionGroup
InstanceConnectionGroup is a class that aggregates parameters for configuring a group of connections to a Tarantool node.
Connection Groups Concept
High-level clients TarantoolCrudClient/ TarantoolBoxClient interact with
Tarantool nodes through logically separated groups of connections. Each group
represents a set of connections (IProtoClient) to one Tarantool node.
When creating a high-level client, the IProtoClientPool object creates connection groups based on
metadata passed in objects of the InstanceConnectionGroup class. One logical group of connections is created based on
metadata from one object of the InstanceConnectionGroup class.
Using multiple connections within one group allows you to increase the performance of the Java client, especially in situations where data operations are performed in parallel. The selection of a connection for executing a request is determined by the balancing rules (more details).
Parameter Description
| Parameter Name | Description | Default Value |
| host | The address of the node to which the connection group should connect | localhost |
| port | The port on which the Tarantool node expects connections. Together with host forms the complete address of the Tarantool node | 3301 |
| user | The username used for client authentication when connecting to the Tarantool node | user |
| password | Password for user | "" |
| size | The number of connections to one node ( Netty connection) | 1 |
| tag | Tag name of the connection group. Required for identifying the group in the connection pool, logs | user:host:port |
| flushConsolidationHandler | More details | null |
| authType | The type of authentication algorithm for the Java client. See Javadoc for the
AuthType class and official
Tarantool documentation for more details
|
AuthType.CHAP_SHA1 |
Values for host and port are specified according to InetSocketAddress.
Usage
To create an instance of the InstanceConnectionGroup class, you need to use
InstanceConnectionGroup.Builder:
final InstanceConnectionGroup connectionGroup = InstanceConnectionGroup.builder()
.withHost("localhost")
.withPort(3301)
.withUser("user2581-test")
.withPassword("pwd-1")
.withSize(3)
.withTag("Node-1")
.withAuthType(AuthType.CHAP_SHA1)
.build();
Then the group is added to the TarantoolCrudClientBuilder or TarantoolBoxClientBuilder: