Non-Blocking Rxified Vertx aerospike client
The Vert.x Aerospike client provides an asynchronous API to interact aerospike server.
Add the following dependency to the dependencies section of your build descriptor:
pom.xml):
<dependency>
<groupId>io.d11</groupId>
<artifactId>vertx-aerospike-client</artifactId>
<version>LATEST</version>
</dependency>
build.gradle file):
dependencies {
compile 'io.d11:vertx-aerospike-client:x.y.z'
}
AerospikeConnectOptions connectOptions = new AerospikeConnectOptions()
.setHosts("my-host")
.setEventLoopSize(16);
// create a shared aerospike client across vertx instance
AerospikeClient client = AerospikeClient.create(vertx, connectOptions);
// create non shared aerospike client
AerospikeClient client = AerospikeClient.createNonShared(vertx, connectOptions);
Configuration options for AerospikeConnectOptions
| Key | Default | Type | Required | Description |
|---|---|---|---|---|
| host | localhost | String | false | Aerospike server host |
| port | 3000 | Integer | false | Aerospike server port |
| eventLoopSize | 2*<#cores> | Integer | false | Number of EventLoop threads |
| maxCommandsInProcess | 100 | Integer | false | Maximum number of commands in process on each EventLoop thread |
| maxCommandsInQueue | 0 | Integer | false | Maximum number of commands in each EventLoop’s queue |
| maxConnsPerNode | 2<#cores>100 | Integer | false | Maximum number of connections to one server node |
| maxConnectRetries | 2 | Integer | false | Maximum number of retries to connect |
| clientPolicy | ClientPolicy | false | Aerospike client policy |
AerospikeClient client = AerospikeClient.create(vertx, connectOptions);
client
.rxGet(policy, key)
.map(record -> {
// Handle record
})...
Detailed documentation can be found here.
To run the test suite:
mvn clean verify
The test suite runs a Docker container from image aerospike/aerospike-server using TestContainers
by default.
To run the test suite on a container built from a different docker image:
mvn clean verify -Daerospike.image=<image>