Class ZookeeperServiceWatch

java.lang.Object
org.springframework.cloud.zookeeper.discovery.ZookeeperServiceWatch
All Implemented Interfaces:
EventListener, org.apache.curator.framework.recipes.cache.TreeCacheListener, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.ApplicationListener<org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent<?>>

public class ZookeeperServiceWatch extends Object implements org.springframework.context.ApplicationListener<org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent<?>>, org.apache.curator.framework.recipes.cache.TreeCacheListener, org.springframework.context.ApplicationEventPublisherAware
A TreeCacheListener that sends HeartbeatEvent when an entry inside Zookeeper has changed.
Since:
1.0.0
Author:
Spencer Gibb
  • Constructor Details

    • ZookeeperServiceWatch

      public ZookeeperServiceWatch(org.apache.curator.framework.CuratorFramework curator, ZookeeperDiscoveryProperties properties)
  • Method Details

    • setApplicationEventPublisher

      public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher)
      Specified by:
      setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware
    • getCache

      public org.apache.curator.framework.recipes.cache.TreeCache getCache()
    • onApplicationEvent

      public void onApplicationEvent(org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent<?> event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent<?>>
    • stop

      @PreDestroy public void stop() throws Exception
      Throws:
      Exception
    • childEvent

      public void childEvent(org.apache.curator.framework.CuratorFramework client, org.apache.curator.framework.recipes.cache.TreeCacheEvent event) throws Exception
      Specified by:
      childEvent in interface org.apache.curator.framework.recipes.cache.TreeCacheListener
      Throws:
      Exception