A Dropwizard bundle for seamless Aerospike integration with metrics, interceptors, and dual-mode operations.
Aerospike Bundle is a Java library that provides a production-ready Dropwizard bundle for connecting to Aerospike clusters. It handles client lifecycle, policy configuration, health checks, metrics, pluggable interceptors, and multi-cluster routing out of the box.
- Dropwizard Integration -- lifecycle-managed Aerospike client
- Configurable Policies -- read, write, scan, query, batch
- Health Checks -- automatic cluster health monitoring
- Metrics & Interceptors -- built-in metric collection with a pluggable interceptor chain
- Dual-Mode Operations -- route reads/writes to different clusters
- TLS Support -- configurable TLS policies and protocols
- Namespace Management -- tag-based namespace resolution
- XDR Lag Monitoring -- cross-datacenter replication lag visibility
Maven
<dependency>
<groupId>com.phonepe</groupId>
<artifactId>aerospike-bundle</artifactId>
<version>${aerospike-bundle.version}</version>
</dependency>Note: Find the latest version on Maven Central.
aerospike:
modeOfOperationType: DEFAULT_MODE
aerospikeConfiguration:
id: "primary"
hosts:
- host: "localhost"
port: 3000
retries: 5
maxConnectionsPerNode: 10
healthcheckEnabled: truepublic class MyApplication extends Application<MyAppConfiguration> {
private final AerospikeBundle<MyAppConfiguration> aerospikeBundle =
new AerospikeBundle<MyAppConfiguration>() {
@Override
protected AerospikeBundleConfig configuration(MyAppConfiguration config) {
return config.getAerospike();
}
};
@Override
public void initialize(Bootstrap<MyAppConfiguration> bootstrap) {
bootstrap.addBundle(aerospikeBundle);
}
@Override
public void run(MyAppConfiguration config, Environment environment) {
IAerospikeClient client = aerospikeBundle.getAerospikeClient();
// Use the client
}
}| Class | Method | Description |
|---|---|---|
AerospikeBundle<T> |
getAerospikeClient() |
Get the configured client |
registerInterceptor(...) |
Add custom interceptor | |
getXdrReplicationLag() |
Get XDR lag details | |
AerospikeConfiguration |
getNamespaceFor(tag) |
Resolve namespace by tag |
Full documentation is available at the project docs site.
See CONTRIBUTING.md.
See CODE_OF_CONDUCT.md.
Distributed under the Apache 2.0 License.