Class ZooKeeperUtils
java.lang.Object
org.apache.camel.component.zookeeper.ZooKeeperUtils
ZooKeeperUtils
contains static utility functions mostly for retrieving optional message properties from
Message headers.-
Method Summary
Modifier and TypeMethodDescriptionstatic List<org.apache.zookeeper.data.ACL>
getAclListFromMessage
(org.apache.camel.Message in) static org.apache.zookeeper.CreateMode
getCreateMode
(org.apache.camel.Message message, org.apache.zookeeper.CreateMode defaultMode) Pulls a createMode flag from the header keyed byZooKeeperMessage.ZOOKEEPER_CREATE_MODE
in the given message and attempts to parse aCreateMode
from it.static org.apache.zookeeper.CreateMode
getCreateModeFromString
(String modeHeader, org.apache.zookeeper.CreateMode defaultMode) static String
getNodeFromMessage
(org.apache.camel.Message message, String defaultNode) Pulls the target node from the header keyed byZooKeeperMessage.ZOOKEEPER_NODE
.static byte[]
getPayloadFromExchange
(org.apache.camel.Exchange exchange) static Integer
getVersionFromMessage
(org.apache.camel.Message message) static org.apache.zookeeper.WatchedEvent
getWatchedEvent
(ZooKeeperOperation<?> zooKeeperOperation) static <T> T
getZookeeperProperty
(org.apache.camel.Message m, String propertyName, T defaultValue, Class<? extends T> type) static boolean
hasWatchedEvent
(ZooKeeperOperation<?> zooKeeperOperation)
-
Method Details
-
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 byZooKeeperMessage.ZOOKEEPER_CREATE_MODE
in the given message and attempts to parse aCreateMode
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
Pulls the target node from the header keyed byZooKeeperMessage.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
-
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
-
getWatchedEvent
public static org.apache.zookeeper.WatchedEvent getWatchedEvent(ZooKeeperOperation<?> zooKeeperOperation) -
hasWatchedEvent
-