Home

Awesome

The Reactive Aerospike Client

Continuous Integration Code Coverage License

Overview

The Vert.x Aerospike client provides an asynchronous API to interact with aerospike server. (Internally uses AerospikeClient's async commands and handles the result on vertx-context)

Usage

Add the following dependency to the dependencies section of your build descriptor:

  <dependency>
    <groupId>io.d11</groupId>
    <artifactId>vertx-aerospike-client</artifactId>
    <version>LATEST</version>
  </dependency>
  dependencies {
   compile 'io.d11:vertx-aerospike-client:x.y.z'
  }

Connecting to Aerospike

  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

Configuration options for AerospikeConnectOptions

KeyDefaultTypeRequiredDescription
hostlocalhostStringfalseAerospike server host
port3000IntegerfalseAerospike server port
eventLoopSize2*<#cores>IntegerfalseNumber of EventLoop threads
maxCommandsInProcess100IntegerfalseMaximum number of commands in process on each EventLoop thread
maxCommandsInQueue0IntegerfalseMaximum number of commands in each EventLoop's queue
maxConnsPerNode2*<#cores>*100IntegerfalseMaximum number of connections to one server node
maxConnectRetries2IntegerfalseMaximum number of retries to connect
clientPolicy<ClientPolicy with replica policy MASTER_PROLES>ClientPolicyfalseAerospike client policy

Note on Configuration options:

Running queries

  AerospikeClient client = AerospikeClient.create(vertx, connectOptions);
  client
    .rxGet(policy, key)
    .map(record -> {
      // Handle record
        })...

Detailed documentation can be found here.

Running the tests

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>