Package com.linkedin.venice.helix
Class HelixStatusMessageChannel
java.lang.Object
com.linkedin.venice.helix.HelixStatusMessageChannel
- All Implemented Interfaces:
StatusMessageChannel
The control message changed built on Helix message service.
It will convert Venice message to helix message when sending and reverse this process when receiving.
Only one Helix message type is used, so channel is similar to a dispatcher that receive all of control messages and dispatch them to related handlers.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionHelixStatusMessageChannel
(SafeHelixManager manager, HelixMessageChannelStats stats) HelixStatusMessageChannel
(SafeHelixManager manager, HelixMessageChannelStats stats, int timeOut) -
Method Summary
Modifier and TypeMethodDescriptionprotected StatusMessage
convertHelixMessageToVeniceMessage
(org.apache.helix.model.Message helixMessage) Convert Helix message to Venice Message.protected org.apache.helix.model.Message
convertVeniceMessageToHelixMessage
(StatusMessage veniceMessage) Convert Venice message to Helix message.protected <T extends StatusMessage>
StatusMessageHandlergetHandler
(Class<T> clazz) Get the handler for given Venice message type.<T extends StatusMessage>
voidregisterHandler
(Class<T> clazz, StatusMessageHandler<T> handler) Register a handler to handle a specific message type.void
sendToController
(StatusMessage message) Send message to controller.void
sendToController
(StatusMessage message, int retryCount, long retryDurationMs) Send message to controller.void
sendToStorageNodes
(String clusterName, StatusMessage message, String resourceName, int retryCount) Send message to all storage nodes in the given cluster.<T extends StatusMessage>
voidunRegisterHandler
(Class<T> clazz, StatusMessageHandler<T> handler) Remove a handler for a specific message type.
-
Field Details
-
DEFAULT_SEND_MESSAGE_TIME_OUT
public static final int DEFAULT_SEND_MESSAGE_TIME_OUT- See Also:
-
HELIX_MESSAGE_TYPE
- See Also:
-
VENICE_MESSAGE_CLASS
- See Also:
-
VENICE_MESSAGE_FIELD
- See Also:
-
-
Constructor Details
-
HelixStatusMessageChannel
-
HelixStatusMessageChannel
public HelixStatusMessageChannel(SafeHelixManager manager, HelixMessageChannelStats stats, int timeOut)
-
-
Method Details
-
sendToController
Description copied from interface:StatusMessageChannel
Send message to controller. If met any error during the sending, retry it after retryDurationMs until retry @retryCount times.- Specified by:
sendToController
in interfaceStatusMessageChannel
retryCount
- retry how many times.retryDurationMs
- the duration between two retries.
-
sendToController
Description copied from interface:StatusMessageChannel
Send message to controller.- Specified by:
sendToController
in interfaceStatusMessageChannel
-
sendToStorageNodes
public void sendToStorageNodes(String clusterName, StatusMessage message, String resourceName, int retryCount) Description copied from interface:StatusMessageChannel
Send message to all storage nodes in the given cluster. If met any error during the sending, retry it after retryDurationMs until retry @retryCount times.- Specified by:
sendToStorageNodes
in interfaceStatusMessageChannel
-
registerHandler
public <T extends StatusMessage> void registerHandler(Class<T> clazz, StatusMessageHandler<T> handler) Description copied from interface:StatusMessageChannel
Register a handler to handle a specific message type.- Specified by:
registerHandler
in interfaceStatusMessageChannel
-
unRegisterHandler
public <T extends StatusMessage> void unRegisterHandler(Class<T> clazz, StatusMessageHandler<T> handler) Description copied from interface:StatusMessageChannel
Remove a handler for a specific message type.- Specified by:
unRegisterHandler
in interfaceStatusMessageChannel
-
convertHelixMessageToVeniceMessage
protected StatusMessage convertHelixMessageToVeniceMessage(org.apache.helix.model.Message helixMessage) Convert Helix message to Venice Message.- Parameters:
helixMessage
-- Returns:
-
convertVeniceMessageToHelixMessage
protected org.apache.helix.model.Message convertVeniceMessageToHelixMessage(StatusMessage veniceMessage) Convert Venice message to Helix message.- Parameters:
veniceMessage
-- Returns:
-
getHandler
Get the handler for given Venice message type.- Type Parameters:
T
-- Parameters:
clazz
-- Returns:
-