You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Stephen Winnall <st...@winnall.ch> on 2017/05/06 21:28:00 UTC
communication between Cellar instances
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
Re: communication between Cellar instances
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
You are welcome.
I think it would be great to update the Cellar user guide to mention this point.
I will do it.
Thanks !
Regards
JB
On 05/07/2017 01:47 PM, Stephen Winnall wrote:
> Hi JB
>
> Thanks for this, it helps a lot! The documentation at docs.hazelcast.org seem to answer most of my follow-up questions.
>
> It's immensely valuable having someone point you in the right direction. Thanks.
>
> Steve
>
>
>> On 7 May 2017, at 07:57, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>>
>> 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
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: communication between Cellar instances
Posted by Stephen Winnall <st...@winnall.ch>.
Hi JB
Thanks for this, it helps a lot! The documentation at docs.hazelcast.org seem to answer most of my follow-up questions.
It's immensely valuable having someone point you in the right direction. Thanks.
Steve
> On 7 May 2017, at 07:57, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>
> 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
Re: communication between Cellar instances
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
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