# Zen

**URL:** <https://discuss.elastic.co/t/zen/3035>\
**Category:** Elasticsearch\
**Created:** [June 22, 2010, 4:44pm UTC](https://discuss.elastic.co/t/zen/3035 "2010-06-22T16:44:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Loy](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Paul\_Loy](https://discuss.elastic.co/u/Paul_Loy)\
**Post date:** [June 22, 2010, 4:44pm UTC](https://discuss.elastic.co/t/zen/3035/1 "2010-06-22T16:44:53Z")

</div>

Hi Shay,

we're interested in using Zen as the discovery mechanism for our services.  
Rather than having yet another discovery mechanism, we'd quite like to reuse  
Zen. Don't suppose you have any docs on how to use Zen outside elastic  
search do you?

Thanks,

Paul.

## --

Paul Loy  
[paul@keteracel.com](mailto:paul@keteracel.com)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [June 22, 2010, 8:04pm UTC](https://discuss.elastic.co/t/zen/3035/2 "2010-06-22T20:04:02Z")

</div>

Not, not really... . Also, I have not invested a lot in making it completely  
separated from elasticsearch, it is a module, but it depends on other  
modules like the transport and so on, and it is tied to the cluster state  
publishing of elasticsearch (though that can be separated out).

-shay.banon

On Tue, Jun 22, 2010 at 7:44 PM, Paul Loy [keteracel@gmail.com](mailto:keteracel@gmail.com) wrote:

> Hi Shay,
> 
> we're interested in using Zen as the discovery mechanism for our services.  
> Rather than having yet another discovery mechanism, we'd quite like to reuse  
> Zen. Don't suppose you have any docs on how to use Zen outside elastic  
> search do you?
> 
> Thanks,
> 
> Paul.
> 
> ## --
> 
> Paul Loy  
> [paul@keteracel.com](mailto:paul@keteracel.com)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 14, 2010, 12:27pm UTC](https://discuss.elastic.co/t/zen/3035/3 "2010-07-14T12:27:49Z")

</div>

By the way, another question, do you plan to use Zen with a running ES  
cluster, and just want to know the state of the cluster more intimately? If  
so, this is simpler to do.

-shay.banon

On Tue, Jun 22, 2010 at 11:04 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Not, not really... . Also, I have not invested a lot in making it  
> completely separated from elasticsearch, it is a module, but it depends on  
> other modules like the transport and so on, and it is tied to the cluster  
> state publishing of elasticsearch (though that can be separated out).
> 
> -shay.banon
> 
> On Tue, Jun 22, 2010 at 7:44 PM, Paul Loy [keteracel@gmail.com](mailto:keteracel@gmail.com) wrote:
> 
> > Hi Shay,
> > 
> > we're interested in using Zen as the discovery mechanism for our services.  
> > Rather than having yet another discovery mechanism, we'd quite like to reuse  
> > Zen. Don't suppose you have any docs on how to use Zen outside elastic  
> > search do you?
> > 
> > Thanks,
> > 
> > Paul.
> > 
> > ## --
> > 
> > Paul Loy  
> > [paul@keteracel.com](mailto:paul@keteracel.com)

---

<div class="post-metadata">

**Author:** ![Paul\_Loy](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Paul\_Loy](https://discuss.elastic.co/u/Paul_Loy)\
**Post date:** [July 14, 2010, 12:32pm UTC](https://discuss.elastic.co/t/zen/3035/4 "2010-07-14T12:32:05Z")

</div>

That's very interesting. Basically we're using Gridgain as well as  
Elasticsearch. Ideally we want to write a discovery SPI for Gridgain that  
can use the same discovery instance as Elasticsearch so we are not  
duplicating discovery chatter. If Zen emitted events, perhaps, then we could  
just hook a custom GG discovery SPI into that.

Or we could just query Zen I suppose, but I like the idea of not doing  
anything until something changes. Less Threads = good!

Thanks,

Paul.

On Wed, Jul 14, 2010 at 1:27 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> By the way, another question, do you plan to use Zen with a running ES  
> cluster, and just want to know the state of the cluster more intimately? If  
> so, this is simpler to do.
> 
> -shay.banon
> 
> On Tue, Jun 22, 2010 at 11:04 PM, Shay Banon \<[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)
> 
> > wrote:
> 
> > Not, not really... . Also, I have not invested a lot in making it  
> > completely separated from elasticsearch, it is a module, but it depends on  
> > other modules like the transport and so on, and it is tied to the cluster  
> > state publishing of elasticsearch (though that can be separated out).
> > 
> > -shay.banon
> > 
> > On Tue, Jun 22, 2010 at 7:44 PM, Paul Loy [keteracel@gmail.com](mailto:keteracel@gmail.com) wrote:
> > 
> > > Hi Shay,
> > > 
> > > we're interested in using Zen as the discovery mechanism for our  
> > > services. Rather than having yet another discovery mechanism, we'd quite  
> > > like to reuse Zen. Don't suppose you have any docs on how to use Zen outside  
> > > Elasticsearch do you?
> > > 
> > > Thanks,
> > > 
> > > Paul.
> > > 
> > > ## --
> > > 
> > > Paul Loy  
> > > [paul@keteracel.com](mailto:paul@keteracel.com)

## --

Paul Loy  
[paul@keteracel.com](mailto:paul@keteracel.com)  
[http://www.keteracel.com/paul](http://www.keteracel.com/paul)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 14, 2010, 12:37pm UTC](https://discuss.elastic.co/t/zen/3035/5 "2010-07-14T12:37:17Z")

</div>

Agreed. Its a bit low level, but here is something that you can do:

ClusterService clusterService = ((InternalNode)  
node).injector().getInstance(ClusterService.class);  
clusterService.add(new MyClusterEventListenre());

MyClusterEventListener implements ClusterStateEventListener {  
public void clusterChanged(ClusterChangedEvent event) {  
// work mainly with event.state().nodes(), and even.nodesDelta()  
// NOTE: don't do anything time consuming on this thread! (like  
IO calls or blocking)  
}  
}

You can add your listener after you build the node, but not start it, so you  
will get all the events.

-shay.banon

On Wed, Jul 14, 2010 at 3:32 PM, Paul Loy [keteracel@gmail.com](mailto:keteracel@gmail.com) wrote:

> That's very interesting. Basically we're using Gridgain as well as  
> Elasticsearch. Ideally we want to write a discovery SPI for Gridgain that  
> can use the same discovery instance as Elasticsearch so we are not  
> duplicating discovery chatter. If Zen emitted events, perhaps, then we could  
> just hook a custom GG discovery SPI into that.
> 
> Or we could just query Zen I suppose, but I like the idea of not doing  
> anything until something changes. Less Threads = good!
> 
> Thanks,
> 
> Paul.
> 
> On Wed, Jul 14, 2010 at 1:27 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:
> 
> > By the way, another question, do you plan to use Zen with a running ES  
> > cluster, and just want to know the state of the cluster more intimately? If  
> > so, this is simpler to do.
> > 
> > -shay.banon
> > 
> > On Tue, Jun 22, 2010 at 11:04 PM, Shay Banon \<  
> > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)\> wrote:
> > 
> > > Not, not really... . Also, I have not invested a lot in making it  
> > > completely separated from elasticsearch, it is a module, but it depends on  
> > > other modules like the transport and so on, and it is tied to the cluster  
> > > state publishing of elasticsearch (though that can be separated out).
> > > 
> > > -shay.banon
> > > 
> > > On Tue, Jun 22, 2010 at 7:44 PM, Paul Loy [keteracel@gmail.com](mailto:keteracel@gmail.com) wrote:
> > > 
> > > > Hi Shay,
> > > > 
> > > > we're interested in using Zen as the discovery mechanism for our  
> > > > services. Rather than having yet another discovery mechanism, we'd quite  
> > > > like to reuse Zen. Don't suppose you have any docs on how to use Zen outside  
> > > > Elasticsearch do you?
> > > > 
> > > > Thanks,
> > > > 
> > > > Paul.
> > > > 
> > > > ## --
> > > > 
> > > > Paul Loy  
> > > > [paul@keteracel.com](mailto:paul@keteracel.com)
> 
> ## --
> 
> Paul Loy  
> [paul@keteracel.com](mailto:paul@keteracel.com)  
> [http://www.keteracel.com/paul](http://www.keteracel.com/paul)

---

<div class="post-metadata">

**Author:** ![Paul\_Loy](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Paul\_Loy](https://discuss.elastic.co/u/Paul_Loy)\
**Post date:** [July 14, 2010, 1:30pm UTC](https://discuss.elastic.co/t/zen/3035/6 "2010-07-14T13:30:52Z")

</div>

Will give that a go.

Thanks.

On Wed, Jul 14, 2010 at 1:37 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Agreed. Its a bit low level, but here is something that you can do:
> 
> ClusterService clusterService = ((InternalNode)  
> node).injector().getInstance(ClusterService.class);  
> clusterService.add(new MyClusterEventListenre());
> 
> MyClusterEventListener implements ClusterStateEventListener {  
> public void clusterChanged(ClusterChangedEvent event) {  
> // work mainly with event.state().nodes(), and even.nodesDelta()  
> // NOTE: don't do anything time consuming on this thread! (like  
> IO calls or blocking)  
> }  
> }
> 
> You can add your listener after you build the node, but not start it, so  
> you will get all the events.
> 
> -shay.banon
> 
> On Wed, Jul 14, 2010 at 3:32 PM, Paul Loy [keteracel@gmail.com](mailto:keteracel@gmail.com) wrote:
> 
> > That's very interesting. Basically we're using Gridgain as well as  
> > Elasticsearch. Ideally we want to write a discovery SPI for Gridgain that  
> > can use the same discovery instance as Elasticsearch so we are not  
> > duplicating discovery chatter. If Zen emitted events, perhaps, then we could  
> > just hook a custom GG discovery SPI into that.
> > 
> > Or we could just query Zen I suppose, but I like the idea of not doing  
> > anything until something changes. Less Threads = good!
> > 
> > Thanks,
> > 
> > Paul.
> > 
> > On Wed, Jul 14, 2010 at 1:27 PM, Shay Banon \<[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)
> > 
> > > wrote:
> > 
> > > By the way, another question, do you plan to use Zen with a running ES  
> > > cluster, and just want to know the state of the cluster more intimately? If  
> > > so, this is simpler to do.
> > > 
> > > -shay.banon
> > > 
> > > On Tue, Jun 22, 2010 at 11:04 PM, Shay Banon \<  
> > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)\> wrote:
> > > 
> > > > Not, not really... . Also, I have not invested a lot in making it  
> > > > completely separated from elasticsearch, it is a module, but it depends on  
> > > > other modules like the transport and so on, and it is tied to the cluster  
> > > > state publishing of elasticsearch (though that can be separated out).
> > > > 
> > > > -shay.banon
> > > > 
> > > > On Tue, Jun 22, 2010 at 7:44 PM, Paul Loy [keteracel@gmail.com](mailto:keteracel@gmail.com) wrote:
> > > > 
> > > > > Hi Shay,
> > > > > 
> > > > > we're interested in using Zen as the discovery mechanism for our  
> > > > > services. Rather than having yet another discovery mechanism, we'd quite  
> > > > > like to reuse Zen. Don't suppose you have any docs on how to use Zen outside  
> > > > > Elasticsearch do you?
> > > > > 
> > > > > Thanks,
> > > > > 
> > > > > Paul.
> > > > > 
> > > > > ## --
> > > > > 
> > > > > Paul Loy  
> > > > > [paul@keteracel.com](mailto:paul@keteracel.com)
> > 
> > ## --
> > 
> > Paul Loy  
> > [paul@keteracel.com](mailto:paul@keteracel.com)  
> > [http://www.keteracel.com/paul](http://www.keteracel.com/paul)

## --

Paul Loy  
[paul@keteracel.com](mailto:paul@keteracel.com)  
[http://www.keteracel.com/paul](http://www.keteracel.com/paul)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:22am UTC](https://discuss.elastic.co/t/zen/3035/7 "2017-07-06T04:22:17Z")

</div>


