Class ZooKeeperUtils


  • public final class ZooKeeperUtils
    extends Object
    ZooKeeperUtils contains static utility functions mostly for retrieving optional message properties from Message headers.
    • Method Detail

      • getCreateMode

        public static org.apache.zookeeper.CreateMode getCreateMode​(org.apache.camel.Message message,
                                                                    org.apache.zookeeper.CreateMode defaultMode)
        Pulls a createMode flag from the header keyed by ZooKeeperMessage.ZOOKEEPER_CREATE_MODE in the given message and attempts to parse a CreateMode from it.
        Parameters:
        message - the message that may contain a ZOOKEEPER_CREATE_MODE header.
        Returns:
        the parsed CreateMode or null if the header was null or not a valid mode flag.
      • getCreateModeFromString

        public static org.apache.zookeeper.CreateMode getCreateModeFromString​(String modeHeader,
                                                                              org.apache.zookeeper.CreateMode defaultMode)
      • getNodeFromMessage

        public static String getNodeFromMessage​(org.apache.camel.Message message,
                                                String defaultNode)
        Pulls the target node from the header keyed by ZooKeeperMessage.ZOOKEEPER_NODE. This node is then typically used in place of the configured node extracted from the endpoint uri.
        Parameters:
        message - the message that may contain a ZOOKEEPER_NODE header.
        Returns:
        the node property or null if the header was null
      • getVersionFromMessage

        public static Integer getVersionFromMessage​(org.apache.camel.Message message)
      • getPayloadFromExchange

        public static byte[] getPayloadFromExchange​(org.apache.camel.Exchange exchange)
      • getAclListFromMessage

        public static List<org.apache.zookeeper.data.ACL> getAclListFromMessage​(org.apache.camel.Message in)
      • getZookeeperProperty

        public static <T> T getZookeeperProperty​(org.apache.camel.Message m,
                                                 String propertyName,
                                                 T defaultValue,
                                                 Class<? extends T> type)
      • getWatchedEvent

        public static org.apache.zookeeper.WatchedEvent getWatchedEvent​(ZooKeeperOperation<?> zooKeeperOperation)
      • hasWatchedEvent

        public static boolean hasWatchedEvent​(ZooKeeperOperation<?> zooKeeperOperation)