org.apache.helix.model.Message.getMsgType()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中org.apache.helix.model.Message.getMsgType()方法的一些代码示例,展示了Message.getMsgType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getMsgType()方法的具体详情如下:
包路径:org.apache.helix.model.Message
类名称:Message
方法名:getMsgType

Message.getMsgType介绍

[英]Get the type of this message
[中]获取此消息的类型

代码示例

代码示例来源:origin: apache/incubator-gobblin

@Test(enabled = false)
@Override
public void assertMessageReception(Message message) {
 Assert.assertEquals(message.getMsgType(), GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE);
 Assert.assertEquals(message.getMsgSubType(), HelixMessageSubTypes.APPLICATION_MASTER_SHUTDOWN.toString());
}

代码示例来源:origin: apache/incubator-gobblin

@Test(enabled = false)
 @Override
 public void assertMessageReception(Message message) {
  Assert.assertEquals(message.getMsgType(), GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE);
  Assert.assertEquals(message.getMsgSubType(), HelixMessageSubTypes.APPLICATION_MASTER_SHUTDOWN.toString());
 }
}

代码示例来源:origin: apache/incubator-gobblin

@Test(enabled = false)
 @Override
 public void assertMessageReception(Message message) {
  Assert.assertEquals(message.getMsgType(), GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE);
  Assert.assertEquals(message.getMsgSubType(), HelixMessageSubTypes.WORK_UNIT_RUNNER_SHUTDOWN.toString());
 }
}

代码示例来源:origin: apache/helix

/**
 * 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();
}

代码示例来源:origin: org.apache.helix/helix-core

/**
 * 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();
}

代码示例来源:origin: apache/helix

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();
 }
}

代码示例来源:origin: org.apache.helix/helix-core

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();
 }
}

代码示例来源:origin: org.apache.helix/helix-core

@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);
}

代码示例来源:origin: apache/helix

@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);
}

代码示例来源:origin: apache/helix

@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);
}

代码示例来源:origin: org.apache.helix/helix-core

@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);
}

代码示例来源:origin: org.apache.helix/helix-core

@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);
}

代码示例来源:origin: apache/helix

@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);
}

代码示例来源:origin: apache/helix

private void setMessageState(CurrentStateOutput currentStateOutput, String resourceName,
   Partition partition, String instanceName, Message message) {
  if (MessageType.STATE_TRANSITION.name().equalsIgnoreCase(message.getMsgType())) {
   currentStateOutput.setPendingMessage(resourceName, partition, instanceName, message);
  } else {
   currentStateOutput.setCancellationMessage(resourceName, partition, instanceName, message);
  }
 }
}

代码示例来源:origin: apache/helix

private String getStatusUpdateKey(Message message) {
 if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.name())) {
  return message.getPartitionName();
 }
 return message.getMsgId();
}

代码示例来源:origin: org.apache.helix/helix-core

private void setMessageState(CurrentStateOutput currentStateOutput, String resourceName,
  Partition partition, String instanceName, Message message) {
 if (MessageType.STATE_TRANSITION.name().equalsIgnoreCase(message.getMsgType())) {
  currentStateOutput.setPendingState(resourceName, partition, instanceName, message);
 } else {
  currentStateOutput.setCancellationState(resourceName, partition, instanceName, message);
 }
}

代码示例来源:origin: org.apache.helix/helix-core

private String getStatusUpdateKey(Message message) {
 if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.name())) {
  return message.getPartitionName();
 }
 return message.getMsgId();
}

代码示例来源:origin: apache/helix

String getStatusUpdateRecordName(Message message) {
 if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.name())) {
  return message.getTgtSessionId() + "__" + message.getResourceName();
 }
 return message.getMsgId();
}

代码示例来源:origin: org.apache.helix/helix-core

@Override
public HelixTaskResult handleMessage() throws InterruptedException {
 String type = _message.getMsgType();
 HelixTaskResult result = new HelixTaskResult();
 if (!type.equals(MessageType.CONTROLLER_MSG.name())) {
  throw new HelixException("Unexpected msg type for message " + _message.getMsgId()
    + " type:" + _message.getMsgType());
 }
 result.getTaskResultMap().put("ControllerResult",
   "msg " + _message.getMsgId() + " from " + _message.getMsgSrc() + " processed");
 result.setSuccess(true);
 return result;
}

代码示例来源:origin: org.apache.helix/helix-core

String getStatusUpdateRecordName(Message message) {
 if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.name())) {
  return message.getTgtSessionId() + "__" + message.getResourceName();
 }
 return message.getMsgId();
}

相关文章