You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Cristiano Costantini <cr...@gmail.com> on 2016/05/26 07:22:57 UTC

[Cellar] Store a cluster config property on the cluster

Hello all,

I want to store a config property using cellar cluster, programmatically
from within a bundle.

(basically, the bundle in the first node to come up on the cluster does
some initialization, when the same bundle is started on another node, this
initialization need not to be repeated and I was thinking to implement it
by storing a cluster wide config property like "myapp.initalized=true")

Could you give me any suggestion on how to implement this?

Thanks,
Cristiano

Re: [Cellar] Store a cluster config property on the cluster

Posted by Cristiano Costantini <cr...@gmail.com>.
Thank you JB,

option 3 seems to me the more inspiring,
I'll go through the code of
https://github.com/apache/karaf/blob/master/config/src/main/java/org/apache/karaf/config/command/PropSetCommand.java
and
https://github.com/apache/karaf-cellar/blob/master/config/src/main/java/org/apache/karaf/cellar/config/shell/PropSetCommand.java
to understand how it works and see if I can apply it.

Thanks!
Cristiano





Il giorno gio 26 mag 2016 alle ore 14:47 Jean-Baptiste Onofré <
jb@nanthrax.net> ha scritto:

> Hi,
>
> you can:
> 1. Use config.listener and so use regular code
> 2. Use the ClusterConfigMBean
> 3. Minic PropSetCommand and directly use the clusterMap (a bit harder)
>
> Regards
> JB
>
> On 05/26/2016 09:22 AM, Cristiano Costantini wrote:
> > Hello all,
> >
> > I want to store a config property using cellar cluster, programmatically
> > from within a bundle.
> >
> > (basically, the bundle in the first node to come up on the cluster does
> > some initialization, when the same bundle is started on another node,
> > this initialization need not to be repeated and I was thinking to
> > implement it by storing a cluster wide config property like
> > "myapp.initalized=true")
> >
> > Could you give me any suggestion on how to implement this?
> >
> > Thanks,
> > Cristiano
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: [Cellar] Store a cluster config property on the cluster

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

you can:
1. Use config.listener and so use regular code
2. Use the ClusterConfigMBean
3. Minic PropSetCommand and directly use the clusterMap (a bit harder)

Regards
JB

On 05/26/2016 09:22 AM, Cristiano Costantini wrote:
> Hello all,
>
> I want to store a config property using cellar cluster, programmatically
> from within a bundle.
>
> (basically, the bundle in the first node to come up on the cluster does
> some initialization, when the same bundle is started on another node,
> this initialization need not to be repeated and I was thinking to
> implement it by storing a cluster wide config property like
> "myapp.initalized=true")
>
> Could you give me any suggestion on how to implement this?
>
> Thanks,
> Cristiano

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