Class ZookeeperMetadataStore

java.lang.Object
org.springframework.integration.zookeeper.metadata.ZookeeperMetadataStore
All Implemented Interfaces:
Lifecycle, Phased, SmartLifecycle, ConcurrentMetadataStore, ListenableMetadataStore, MetadataStore

public class ZookeeperMetadataStore extends Object implements ListenableMetadataStore, SmartLifecycle
Zookeeper-based ListenableMetadataStore based on a Zookeeper node. Values are stored in the children node, the names of which are stored as keys.
Since:
4.2
Author:
Marius Bogoevici, Gary Russell, Artem Bilan, Christian Tzolov
  • Constructor Details

    • ZookeeperMetadataStore

      public ZookeeperMetadataStore(org.apache.curator.framework.CuratorFramework client)
  • Method Details

    • setEncoding

      public void setEncoding(String encoding)
      Encoding to use when storing data in ZooKeeper
      Parameters:
      encoding - encoding as text
    • setRoot

      public void setRoot(String root)
      Root node - store entries are children of this node.
      Parameters:
      root - encoding as text
    • getRoot

      public String getRoot()
    • setAutoStartup

      public void setAutoStartup(boolean autoStartup)
    • setPhase

      public void setPhase(int phase)
    • putIfAbsent

      public String putIfAbsent(String key, String value)
      Description copied from interface: ConcurrentMetadataStore
      Atomically insert the key into the store.
      Specified by:
      putIfAbsent in interface ConcurrentMetadataStore
      Parameters:
      key - The key.
      value - The value.
      Returns:
      null if successful, the old value otherwise.
    • replace

      public boolean replace(String key, String oldValue, String newValue)
      Description copied from interface: ConcurrentMetadataStore
      Atomically replace the value for the key in the store if the old value matches the oldValue argument.
      Specified by:
      replace in interface ConcurrentMetadataStore
      Parameters:
      key - The key.
      oldValue - The old value.
      newValue - The new value.
      Returns:
      true if successful.
    • addListener

      public void addListener(MetadataStoreListener listener)
      Description copied from interface: ListenableMetadataStore
      Register a listener with the metadata store.
      Specified by:
      addListener in interface ListenableMetadataStore
      Parameters:
      listener - the callback to be registered
    • removeListener

      public void removeListener(MetadataStoreListener callback)
      Description copied from interface: ListenableMetadataStore
      Unregister a listener.
      Specified by:
      removeListener in interface ListenableMetadataStore
      Parameters:
      callback - the callback to be unregistered
    • put

      public void put(String key, String value)
      Description copied from interface: MetadataStore
      Writes a key value pair to this MetadataStore.
      Specified by:
      put in interface MetadataStore
      Parameters:
      key - The key.
      value - The value.
    • get

      public String get(String key)
      Description copied from interface: MetadataStore
      Reads a value for the given key from this MetadataStore.
      Specified by:
      get in interface MetadataStore
      Parameters:
      key - The key.
      Returns:
      The value.
    • remove

      public String remove(String key)
      Description copied from interface: MetadataStore
      Remove a value for the given key from this MetadataStore.
      Specified by:
      remove in interface MetadataStore
      Parameters:
      key - The key.
      Returns:
      The previous value associated with key, or null if there was no mapping for key.
    • getPath

      public String getPath(String key)
    • isAutoStartup

      public boolean isAutoStartup()
      Specified by:
      isAutoStartup in interface SmartLifecycle
    • start

      public void start()
      Specified by:
      start in interface Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface Lifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface Lifecycle
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface Phased
      Specified by:
      getPhase in interface SmartLifecycle