本文整理汇总了Java中org.apache.helix.model.Message.getMsgType方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getMsgType方法的具体用法?Java Message.getMsgType怎么用?Java Message.getMsgType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.helix.model.Message
的用法示例。
在下文中一共展示了Message.getMsgType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBecomeCompletedFromOffline
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "COMPLETED", from = "OFFLINE")
public void onBecomeCompletedFromOffline(Message message, NotificationContext context)
throws InterruptedException {
logger.info(_partitionKey + " onBecomeCompletedFromOffline");
// Construct the inner task message from the mapfields of scheduledTaskQueue resource group
Map<String, String> messageInfo =
message.getRecord().getMapField(Message.Attributes.INNER_MESSAGE.toString());
ZNRecord record = new ZNRecord(_partitionKey);
record.getSimpleFields().putAll(messageInfo);
Message taskMessage = new Message(record);
if (logger.isDebugEnabled()) {
logger.debug(taskMessage.getRecord().getSimpleFields().toString());
}
MessageHandler handler =
_executor.createMessageHandler(taskMessage, new NotificationContext(null));
if (handler == null) {
throw new HelixException("Task message " + taskMessage.getMsgType()
+ " handler not found, task id " + _partitionKey);
}
// Invoke the internal handler to complete the task
handler.handleMessage();
logger.info(_partitionKey + " onBecomeCompletedFromOffline completed");
}
示例2: createHandler
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Override
public MessageHandler createHandler(Message message, NotificationContext context) {
String type = message.getMsgType();
if (!type.equals(getMessageType())) {
throw new HelixException("Unexpected msg type for message " + message.getMsgId() + " type:"
+ message.getMsgType());
}
return new DefaultControllerMessageHandler(message, context);
}
示例3: createHandler
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Override
public MessageHandler createHandler(Message message, NotificationContext context) {
String type = message.getMsgType();
if (!type.equals(getMessageType())) {
throw new HelixException("Unexpected msg type for message " + message.getMsgId() + " type:"
+ message.getMsgType());
}
return new DefaultParticipantErrorMessageHandler(message, context, _manager);
}
示例4: createHandler
import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Override
public MessageHandler createHandler(Message message, NotificationContext context) {
String type = message.getMsgType();
if (!type.equals(getMessageType())) {
throw new HelixException("Unexpected msg type for message " + message.getMsgId() + " type:"
+ message.getMsgType());
}
return new DefaultSchedulerMessageHandler(message, context, _manager);
}
示例5: getRecordIdForMessage
import org.apache.helix.model.Message; //导入方法依赖的package包/类
private String getRecordIdForMessage(Message message) {
if (message.getMsgType().equals(MessageType.STATE_TRANSITION)) {
return message.getPartitionName() + " Trans:" + message.getFromState().charAt(0) + "->"
+ message.getToState().charAt(0) + " " + UUID.randomUUID().toString();
} else {
return message.getMsgType() + " " + UUID.randomUUID().toString();
}
}
示例6: getStatusUpdateSubPath
import org.apache.helix.model.Message; //导入方法依赖的package包/类
/**
* Generate the sub-path under STATUSUPDATE or ERROR path for a status update
*/
String getStatusUpdateSubPath(Message message) {
if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.name())) {
return message.getResourceName();
}
return message.getMsgType();
}