curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jordan Zimmerman <>
Subject Re: Fwd: Not receiving remove events on PathChildrenCache
Date Tue, 21 Apr 2015 18:18:44 GMT
ServiceDiscovery has its own listener: ServiceCacheListener - use that.


On April 21, 2015 at 1:17:10 PM, Arbi Akhina ( wrote:

I'm using Apache Curator for service discovery, and PathChildrenCache to listen for events
when a service is added/updated/deleted.

PathChildrenCache pathCache = new PathChildrenCache(client, "/directory", true);
pathCache.getListenable().addListener(new PathChildrenCacheListener() {
  public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception
    if(event.getType() == PathChildrenCacheEvent.Type.CHILD_ADDED) {
    }else if(event.getType() == PathChildrenCacheEvent.Type.CHILD_UPDATED) {
    }else if(event.getType() == PathChildrenCacheEvent.Type.CHILD_REMOVED) {
When I register a service through org.apache.curator.x.discovery.ServiceDiscovery, I got
an added event. But when I un-register a service I don't get the removed event.

How I could properly listen to service events?

View raw message