# Registering node event listeners

**URL:** <https://discuss.elastic.co/t/registering-node-event-listeners/17271>\
**Category:** Elasticsearch\
**Created:** [April 29, 2014, 10:17pm UTC](https://discuss.elastic.co/t/registering-node-event-listeners/17271 "2014-04-29T22:17:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 29, 2014, 10:17pm UTC](https://discuss.elastic.co/t/registering-node-event-listeners/17271/1 "2014-04-29T22:17:15Z")

</div>

I am looking to transition a piece of my search infrastructure from polling  
the cluster's health status to hopefully receiving notifications whenever  
an event occurs. Using the TransportService, I registered various relevant  
listeners, but none of them are triggered.

Here is the gist of the code:

> <https://gist.github.com/brusic/2dcced28e0ed753b6632>

Most of it I stole^H^H^H^H^Hborrowed from ZenDiscovery. I am assuming  
something is not quite right with the TransportService. I tried using both  
a node client and a master-less/data-less client. I also suspect that  
the DiscoveryNodesProvider might not have been initialized correctly, but I  
am primarily after the events from NodesFaultDetection, which does not use  
the DiscoveryNodesProvider.

I know I am missing something obvious, but I cannot quite spot it. Is there  
perhaps a different route using the TransportClient?

Cheers,

Ivan

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [April 30, 2014, 11:40am UTC](https://discuss.elastic.co/t/registering-node-event-listeners/17271/2 "2014-04-30T11:40:18Z")

</div>

Have you looked at InternalNode.java?

Form my understanding you could try to implement your own DiscoveryModule  
with DiscoveryService and start it like this

```
    DiscoveryService discoService =

```

injector.getInstance(DiscoveryService.class).start();

Jörg

On Wed, Apr 30, 2014 at 12:17 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> I am looking to transition a piece of my search infrastructure from  
> polling the cluster's health status to hopefully receiving notifications  
> whenever an event occurs. Using the TransportService, I registered various  
> relevant listeners, but none of them are triggered.
> 
> Here is the gist of the code:
> 
> [Node Event Detection · GitHub](https://gist.github.com/brusic/2dcced28e0ed753b6632)
> 
> Most of it I stole^H^H^H^H^Hborrowed from ZenDiscovery. I am assuming  
> something is not quite right with the TransportService. I tried using both  
> a node client and a master-less/data-less client. I also suspect that  
> the DiscoveryNodesProvider might not have been initialized correctly, but I  
> am primarily after the events from NodesFaultDetection, which does not use  
> the DiscoveryNodesProvider.
> 
> I know I am missing something obvious, but I cannot quite spot it. Is  
> there perhaps a different route using the TransportClient?
> 
> Cheers,
> 
> Ivan
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 30, 2014, 1:56pm UTC](https://discuss.elastic.co/t/registering-node-event-listeners/17271/3 "2014-04-30T13:56:41Z")

</div>

Would the DiscoverService solve my initial problem or only get around  
constructing a DiscoveryNodesProvider? DiscoverService only uses  
the InitialStateDiscoveryListener, which doesn't publish interesting events.

I won't be near a computer in the next few days to test.

--  
Ivan

On Wed, Apr 30, 2014 at 4:40 AM, [joergprante@gmail.com](mailto:joergprante@gmail.com) \<  
[joergprante@gmail.com](mailto:joergprante@gmail.com)\> wrote:

> Have you looked at InternalNode.java?
> 
> Form my understanding you could try to implement your own DiscoveryModule  
> with DiscoveryService and start it like this
> 
> ```
> DiscoveryService discoService =
> 
> ```
> 
> injector.getInstance(DiscoveryService.class).start();
> 
> Jörg
> 
> On Wed, Apr 30, 2014 at 12:17 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > I am looking to transition a piece of my search infrastructure from  
> > polling the cluster's health status to hopefully receiving notifications  
> > whenever an event occurs. Using the TransportService, I registered various  
> > relevant listeners, but none of them are triggered.
> > 
> > Here is the gist of the code:
> > 
> > [Node Event Detection · GitHub](https://gist.github.com/brusic/2dcced28e0ed753b6632)
> > 
> > Most of it I stole^H^H^H^H^Hborrowed from ZenDiscovery. I am assuming  
> > something is not quite right with the TransportService. I tried using both  
> > a node client and a master-less/data-less client. I also suspect that  
> > the DiscoveryNodesProvider might not have been initialized correctly, but I  
> > am primarily after the events from NodesFaultDetection, which does not use  
> > the DiscoveryNodesProvider.
> > 
> > I know I am missing something obvious, but I cannot quite spot it. Is  
> > there perhaps a different route using the TransportClient?
> > 
> > Cheers,
> > 
> > Ivan
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQB%2B%3Dox\_Q7D-U%3DVVROusfdGuJWHF\_hxZJAT85NAZ0d%3D1eg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQB%2B%3Dox_Q7D-U%3DVVROusfdGuJWHF_hxZJAT85NAZ0d%3D1eg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 30, 2014, 3:39pm UTC](https://discuss.elastic.co/t/registering-node-event-listeners/17271/4 "2014-04-30T15:39:14Z")

</div>

I should add that I am still on version 0.90.2. Looking to finally  
transition to 1.1 relatively soon. Our search infrastructure has had 100%  
uptime in the past two years, but it comes at the expense of not upgrading  
often.

--  
Ivan

On Wed, Apr 30, 2014 at 6:56 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Would the DiscoverService solve my initial problem or only get around  
> constructing a DiscoveryNodesProvider? DiscoverService only uses  
> the InitialStateDiscoveryListener, which doesn't publish interesting events.
> 
> I won't be near a computer in the next few days to test.
> 
> --  
> Ivan
> 
> On Wed, Apr 30, 2014 at 4:40 AM, [joergprante@gmail.com](mailto:joergprante@gmail.com) \<  
> [joergprante@gmail.com](mailto:joergprante@gmail.com)\> wrote:
> 
> > Have you looked at InternalNode.java?
> > 
> > Form my understanding you could try to implement your own DiscoveryModule  
> > with DiscoveryService and start it like this
> > 
> > ```
> > DiscoveryService discoService =
> > 
> > ```
> > 
> > injector.getInstance(DiscoveryService.class).start();
> > 
> > Jörg
> > 
> > On Wed, Apr 30, 2014 at 12:17 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > 
> > > I am looking to transition a piece of my search infrastructure from  
> > > polling the cluster's health status to hopefully receiving notifications  
> > > whenever an event occurs. Using the TransportService, I registered various  
> > > relevant listeners, but none of them are triggered.
> > > 
> > > Here is the gist of the code:
> > > 
> > > [Node Event Detection · GitHub](https://gist.github.com/brusic/2dcced28e0ed753b6632)
> > > 
> > > Most of it I stole^H^H^H^H^Hborrowed from ZenDiscovery. I am assuming  
> > > something is not quite right with the TransportService. I tried using both  
> > > a node client and a master-less/data-less client. I also suspect that  
> > > the DiscoveryNodesProvider might not have been initialized correctly, but I  
> > > am primarily after the events from NodesFaultDetection, which does not use  
> > > the DiscoveryNodesProvider.
> > > 
> > > I know I am missing something obvious, but I cannot quite spot it. Is  
> > > there perhaps a different route using the TransportClient?
> > > 
> > > Cheers,
> > > 
> > > Ivan
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [April 30, 2014, 3:56pm UTC](https://discuss.elastic.co/t/registering-node-event-listeners/17271/5 "2014-04-30T15:56:01Z")

</div>

Not sure what events you are after, but I guess you just want to push  
notifications about node failures?

You could write a plugin that simply registers a listener to Zen's  
NodesFaultDetection.addListener() and trigger the action you want (send  
email, whatever) in the onNodeFailure() method of the listener.

Jörg

On Wed, Apr 30, 2014 at 5:39 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> I should add that I am still on version 0.90.2. Looking to finally  
> transition to 1.1 relatively soon. Our search infrastructure has had 100%  
> uptime in the past two years, but it comes at the expense of not upgrading  
> often.
> 
> --  
> Ivan
> 
> On Wed, Apr 30, 2014 at 6:56 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > Would the DiscoverService solve my initial problem or only get around  
> > constructing a DiscoveryNodesProvider? DiscoverService only uses  
> > the InitialStateDiscoveryListener, which doesn't publish interesting events.
> > 
> > I won't be near a computer in the next few days to test.
> > 
> > --  
> > Ivan
> > 
> > On Wed, Apr 30, 2014 at 4:40 AM, [joergprante@gmail.com](mailto:joergprante@gmail.com) \<  
> > [joergprante@gmail.com](mailto:joergprante@gmail.com)\> wrote:
> > 
> > > Have you looked at InternalNode.java?
> > > 
> > > Form my understanding you could try to implement your own  
> > > DiscoveryModule with DiscoveryService and start it like this
> > > 
> > > ```
> > > DiscoveryService discoService =
> > > 
> > > ```
> > > 
> > > injector.getInstance(DiscoveryService.class).start();
> > > 
> > > Jörg
> > > 
> > > On Wed, Apr 30, 2014 at 12:17 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > 
> > > > I am looking to transition a piece of my search infrastructure from  
> > > > polling the cluster's health status to hopefully receiving notifications  
> > > > whenever an event occurs. Using the TransportService, I registered various  
> > > > relevant listeners, but none of them are triggered.
> > > > 
> > > > Here is the gist of the code:
> > > > 
> > > > [Node Event Detection · GitHub](https://gist.github.com/brusic/2dcced28e0ed753b6632)
> > > > 
> > > > Most of it I stole^H^H^H^H^Hborrowed from ZenDiscovery. I am assuming  
> > > > something is not quite right with the TransportService. I tried using both  
> > > > a node client and a master-less/data-less client. I also suspect that  
> > > > the DiscoveryNodesProvider might not have been initialized correctly, but I  
> > > > am primarily after the events from NodesFaultDetection, which does not use  
> > > > the DiscoveryNodesProvider.
> > > > 
> > > > I know I am missing something obvious, but I cannot quite spot it. Is  
> > > > there perhaps a different route using the TransportClient?
> > > > 
> > > > Cheers,
> > > > 
> > > > Ivan
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGH5ifNAuK%3DvZaKEi3FnAX921pX69gy7bCwYdgiBhTv4w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGH5ifNAuK%3DvZaKEi3FnAX921pX69gy7bCwYdgiBhTv4w%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 30, 2014, 4:17pm UTC](https://discuss.elastic.co/t/registering-node-event-listeners/17271/6 "2014-04-30T16:17:58Z")

</div>

NodesFaultDetection is what I am looking into using, but on the client  
side, not as a plugin. I use similar code to create an AnalysisService  
locally, but no luck when it comes to TransportService actions.

--  
Ivan

On Wed, Apr 30, 2014 at 8:56 AM, [joergprante@gmail.com](mailto:joergprante@gmail.com) \<  
[joergprante@gmail.com](mailto:joergprante@gmail.com)\> wrote:

> Not sure what events you are after, but I guess you just want to push  
> notifications about node failures?
> 
> You could write a plugin that simply registers a listener to Zen's  
> NodesFaultDetection.addListener() and trigger the action you want (send  
> email, whatever) in the onNodeFailure() method of the listener.
> 
> Jörg
> 
> On Wed, Apr 30, 2014 at 5:39 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > I should add that I am still on version 0.90.2. Looking to finally  
> > transition to 1.1 relatively soon. Our search infrastructure has had 100%  
> > uptime in the past two years, but it comes at the expense of not upgrading  
> > often.
> > 
> > --  
> > Ivan
> > 
> > On Wed, Apr 30, 2014 at 6:56 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > 
> > > Would the DiscoverService solve my initial problem or only get around  
> > > constructing a DiscoveryNodesProvider? DiscoverService only uses  
> > > the InitialStateDiscoveryListener, which doesn't publish interesting events.
> > > 
> > > I won't be near a computer in the next few days to test.
> > > 
> > > --  
> > > Ivan
> > > 
> > > On Wed, Apr 30, 2014 at 4:40 AM, [joergprante@gmail.com](mailto:joergprante@gmail.com) \<  
> > > [joergprante@gmail.com](mailto:joergprante@gmail.com)\> wrote:
> > > 
> > > > Have you looked at InternalNode.java?
> > > > 
> > > > Form my understanding you could try to implement your own  
> > > > DiscoveryModule with DiscoveryService and start it like this
> > > > 
> > > > ```
> > > > DiscoveryService discoService =
> > > > 
> > > > ```
> > > > 
> > > > injector.getInstance(DiscoveryService.class).start();
> > > > 
> > > > Jörg
> > > > 
> > > > On Wed, Apr 30, 2014 at 12:17 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > > 
> > > > > I am looking to transition a piece of my search infrastructure from  
> > > > > polling the cluster's health status to hopefully receiving notifications  
> > > > > whenever an event occurs. Using the TransportService, I registered various  
> > > > > relevant listeners, but none of them are triggered.
> > > > > 
> > > > > Here is the gist of the code:
> > > > > 
> > > > > [Node Event Detection · GitHub](https://gist.github.com/brusic/2dcced28e0ed753b6632)
> > > > > 
> > > > > Most of it I stole^H^H^H^H^Hborrowed from ZenDiscovery. I am assuming  
> > > > > something is not quite right with the TransportService. I tried using both  
> > > > > a node client and a master-less/data-less client. I also suspect that  
> > > > > the DiscoveryNodesProvider might not have been initialized correctly, but I  
> > > > > am primarily after the events from NodesFaultDetection, which does not use  
> > > > > the DiscoveryNodesProvider.
> > > > > 
> > > > > I know I am missing something obvious, but I cannot quite spot it. Is  
> > > > > there perhaps a different route using the TransportClient?
> > > > > 
> > > > > Cheers,
> > > > > 
> > > > > Ivan
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGH5ifNAuK%3DvZaKEi3FnAX921pX69gy7bCwYdgiBhTv4w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGH5ifNAuK%3DvZaKEi3FnAX921pX69gy7bCwYdgiBhTv4w%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGH5ifNAuK%3DvZaKEi3FnAX921pX69gy7bCwYdgiBhTv4w%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGH5ifNAuK%3DvZaKEi3FnAX921pX69gy7bCwYdgiBhTv4w%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQD-dmivL74YbFVgusgFKzbpt0i%3DFRP\_0vLiWh97JOOhJw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQD-dmivL74YbFVgusgFKzbpt0i%3DFRP_0vLiWh97JOOhJw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [May 6, 2014, 4:59pm UTC](https://discuss.elastic.co/t/registering-node-event-listeners/17271/7 "2014-05-06T16:59:02Z")

</div>

Not possible I guess.

On Wed, Apr 30, 2014 at 9:17 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> NodesFaultDetection is what I am looking into using, but on the client  
> side, not as a plugin. I use similar code to create an AnalysisService  
> locally, but no luck when it comes to TransportService actions.
> 
> --  
> Ivan
> 
> On Wed, Apr 30, 2014 at 8:56 AM, [joergprante@gmail.com](mailto:joergprante@gmail.com) \<  
> [joergprante@gmail.com](mailto:joergprante@gmail.com)\> wrote:
> 
> > Not sure what events you are after, but I guess you just want to push  
> > notifications about node failures?
> > 
> > You could write a plugin that simply registers a listener to Zen's  
> > NodesFaultDetection.addListener() and trigger the action you want (send  
> > email, whatever) in the onNodeFailure() method of the listener.
> > 
> > Jörg
> > 
> > On Wed, Apr 30, 2014 at 5:39 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > 
> > > I should add that I am still on version 0.90.2. Looking to finally  
> > > transition to 1.1 relatively soon. Our search infrastructure has had 100%  
> > > uptime in the past two years, but it comes at the expense of not upgrading  
> > > often.
> > > 
> > > --  
> > > Ivan
> > > 
> > > On Wed, Apr 30, 2014 at 6:56 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > 
> > > > Would the DiscoverService solve my initial problem or only get around  
> > > > constructing a DiscoveryNodesProvider? DiscoverService only uses  
> > > > the InitialStateDiscoveryListener, which doesn't publish interesting events.
> > > > 
> > > > I won't be near a computer in the next few days to test.
> > > > 
> > > > --  
> > > > Ivan
> > > > 
> > > > On Wed, Apr 30, 2014 at 4:40 AM, [joergprante@gmail.com](mailto:joergprante@gmail.com) \<  
> > > > [joergprante@gmail.com](mailto:joergprante@gmail.com)\> wrote:
> > > > 
> > > > > Have you looked at InternalNode.java?
> > > > > 
> > > > > Form my understanding you could try to implement your own  
> > > > > DiscoveryModule with DiscoveryService and start it like this
> > > > > 
> > > > > ```
> > > > > DiscoveryService discoService =
> > > > > 
> > > > > ```
> > > > > 
> > > > > injector.getInstance(DiscoveryService.class).start();
> > > > > 
> > > > > Jörg
> > > > > 
> > > > > On Wed, Apr 30, 2014 at 12:17 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > > > 
> > > > > > I am looking to transition a piece of my search infrastructure from  
> > > > > > polling the cluster's health status to hopefully receiving notifications  
> > > > > > whenever an event occurs. Using the TransportService, I registered various  
> > > > > > relevant listeners, but none of them are triggered.
> > > > > > 
> > > > > > Here is the gist of the code:
> > > > > > 
> > > > > > [Node Event Detection · GitHub](https://gist.github.com/brusic/2dcced28e0ed753b6632)
> > > > > > 
> > > > > > Most of it I stole^H^H^H^H^Hborrowed from ZenDiscovery. I am assuming  
> > > > > > something is not quite right with the TransportService. I tried using both  
> > > > > > a node client and a master-less/data-less client. I also suspect that  
> > > > > > the DiscoveryNodesProvider might not have been initialized correctly, but I  
> > > > > > am primarily after the events from NodesFaultDetection, which does not use  
> > > > > > the DiscoveryNodesProvider.
> > > > > > 
> > > > > > I know I am missing something obvious, but I cannot quite spot it. Is  
> > > > > > there perhaps a different route using the TransportClient?
> > > > > > 
> > > > > > Cheers,
> > > > > > 
> > > > > > Ivan
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to the Google  
> > > > > > Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > To view this discussion on the web visit  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By\_oqkV3\_SjS9T\_kikG9Z%2BBi6DJ\_jOydHYBCA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC5twFLr%2By_oqkV3_SjS9T_kikG9Z%2BBi6DJ_jOydHYBCA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > .  
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEVGCvFFaeJmxba-UZEuKS7EK5FakqBbSgy4qUGuywtYg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBXfkD6B%3DK4fRRtdUNa3QLEj2a10J2xexZ2uuq0BR4y%3Dw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGH5ifNAuK%3DvZaKEi3FnAX921pX69gy7bCwYdgiBhTv4w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGH5ifNAuK%3DvZaKEi3FnAX921pX69gy7bCwYdgiBhTv4w%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGH5ifNAuK%3DvZaKEi3FnAX921pX69gy7bCwYdgiBhTv4w%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGH5ifNAuK%3DvZaKEi3FnAX921pX69gy7bCwYdgiBhTv4w%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDkVjFHyrpW57z%3DtWKuDVTkvp%3D44YV8xxE%2BF%2BQcw8q3bw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDkVjFHyrpW57z%3DtWKuDVTkvp%3D44YV8xxE%2BF%2BQcw8q3bw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:31am UTC](https://discuss.elastic.co/t/registering-node-event-listeners/17271/8 "2017-07-06T01:31:17Z")

</div>


