karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré ...@nanthrax.net>
Subject Re: communication between Cellar instances
Date Sun, 07 May 2017 05:57:25 GMT
Hi Steve,

In your code, you can use the Cellar Hazelcast instance (exposed as a service). 
Then, you can store the data (shared between Cellar nodes) using a distributed 
list (or map or set). NB: the class you put in the distributed resources has to 
implement Serializable.

For instance:

ServiceReference ref = bundleContext.getServiceReference(HazelcastInstance.class);
HazelcastInstance cellar = bundleContext.getService(ref);
List distributedList = cellar.getList("name");
// add an element to the list
distributedList.add(new MySerializableClass());
// it's available on the other nodes

Cellar uses this internally to store the state of the features, bundles, config, 
DOSGi, etc.

Regards
JB

On 05/06/2017 11:28 PM, Stephen Winnall wrote:
> Is there a way for instances within a Cellar cluster to communicate with each other and
exchange data? I’d like to be able to associate objects with specific instances but still
allow other instances to retrieve objects via other instances in the cluster.
>
> Steve
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Mime
View raw message