Class ConsumerNodesRegistry
- java.lang.Object
-
- org.apache.curator.framework.recipes.cache.PathChildrenCache
-
- pl.allegro.tech.hermes.consumers.registry.ConsumerNodesRegistry
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,org.apache.curator.framework.recipes.cache.PathChildrenCacheListener
public class ConsumerNodesRegistry extends org.apache.curator.framework.recipes.cache.PathChildrenCache implements org.apache.curator.framework.recipes.cache.PathChildrenCacheListener
-
-
Constructor Summary
Constructors Constructor Description ConsumerNodesRegistry(org.apache.curator.framework.CuratorFramework curatorClient, java.util.concurrent.ExecutorService executorService, ConsumerNodesRegistryPaths registryPaths, java.lang.String consumerNodeId, long deathOfConsumerAfterSeconds, java.time.Clock clock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLeaderLatchListener(org.apache.curator.framework.recipes.leader.LeaderLatchListener listener)voidchildEvent(org.apache.curator.framework.CuratorFramework client, org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent event)java.lang.StringgetConsumerId()booleanisLeader()booleanisRegistered(java.lang.String consumerNodeId)java.util.List<java.lang.String>listConsumerNodes()voidrefresh()voidremoveLeaderLatchListener(org.apache.curator.framework.recipes.leader.LeaderLatchListener listener)voidstart()voidstop()
-
-
-
Constructor Detail
-
ConsumerNodesRegistry
public ConsumerNodesRegistry(org.apache.curator.framework.CuratorFramework curatorClient, java.util.concurrent.ExecutorService executorService, ConsumerNodesRegistryPaths registryPaths, java.lang.String consumerNodeId, long deathOfConsumerAfterSeconds, java.time.Clock clock)
-
-
Method Detail
-
start
public void start() throws java.lang.Exception- Overrides:
startin classorg.apache.curator.framework.recipes.cache.PathChildrenCache- Throws:
java.lang.Exception
-
stop
public void stop() throws java.io.IOException- Throws:
java.io.IOException
-
childEvent
public void childEvent(org.apache.curator.framework.CuratorFramework client, org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent event) throws java.lang.Exception- Specified by:
childEventin interfaceorg.apache.curator.framework.recipes.cache.PathChildrenCacheListener- Throws:
java.lang.Exception
-
isRegistered
public boolean isRegistered(java.lang.String consumerNodeId)
-
isLeader
public boolean isLeader()
-
listConsumerNodes
public java.util.List<java.lang.String> listConsumerNodes()
-
refresh
public void refresh()
-
getConsumerId
public java.lang.String getConsumerId()
-
addLeaderLatchListener
public void addLeaderLatchListener(org.apache.curator.framework.recipes.leader.LeaderLatchListener listener)
-
removeLeaderLatchListener
public void removeLeaderLatchListener(org.apache.curator.framework.recipes.leader.LeaderLatchListener listener)
-
-