Aerospike Spring Data Multiple Namespaces

Viewed 167

How can I configure multiple namespaces with same host list?

I am using

public class AerospikeConfiguration extends AbstractAerospikeDataConfiguration

Unlike hosts, I can only pass in one namespace name:

@Override
protected String nameSpace() {
    return app.getAerospikeNamespace();
}
1 Answers

Update:

Starting at spring-data-aerospike version 3.1.0 there is support for multiple namespaces. https://github.com/aerospike-community/spring-data-aerospike/releases/tag/3.1.0

You can also check out a multiple namespaces project example here: https://github.com/aerospike-examples/spring-data-multiple-namespaces-example


There is no easy way to do this, providing the host list and a namespace creates an AerospikeTemplate @bean with a fixed name (that requires a single namespace).

If you try to create an additional configuration class with a different namespace your application won't start ("A bean with that name has already been defined in...").

I guess there is a way by extending AerospikeDataConfigurationSupport with your own class similar to AbstractAerospikeDataConfiguration and provide 2 AerospikeTemplates that matches the namespaces.

Is there a critical reason for using 2 namespaces in the same application? you should consider an Aerospike set if your goal is to "separate" the data.

Related