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

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

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

Message.getRecord介绍

暂无

代码示例

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

public TimeboundaryRefreshMessage(Message message) {
  super(message.getRecord());
  String msgSubType = message.getMsgSubType();
  Preconditions.checkArgument(msgSubType.equals(REFRESH_TIME_BOUNDARY_MSG_SUB_TYPE),
    "Invalid message sub type: " + msgSubType + " for TimeboundaryRefreshMessage");
 }
}

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

public SegmentReloadMessage(Message message) {
  super(message.getRecord());
  String msgSubType = message.getMsgSubType();
  Preconditions.checkArgument(msgSubType.equals(RELOAD_SEGMENT_MSG_SUB_TYPE),
    "Invalid message sub type: " + msgSubType + " for SegmentReloadMessage");
 }
}

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

/**
 * @param message The incoming message that has been received from helix.
 * @throws IllegalArgumentException if the message is not of right sub-type
 */
public SegmentRefreshMessage(final Message message) {
 super(message.getRecord());
 if (!message.getMsgSubType().equals(REFRESH_SEGMENT_MSG_SUB_TYPE)) {
  throw new IllegalArgumentException("Invalid message subtype:" + message.getMsgSubType());
 }
}

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

private List<Message> generateMessagesForController(Message message) {
 List<Message> messages = new ArrayList<Message>();
 String id = UUID.randomUUID().toString();
 Message newMessage = new Message(message.getRecord(), id);
 newMessage.setMsgId(id);
 newMessage.setSrcName(_manager.getInstanceName());
 newMessage.setTgtName("Controller");
 messages.add(newMessage);
 return messages;
}

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

Message newMessage = new Message(message.getRecord(), id);
String srcInstanceName = _manager.getInstanceName();
String tgtInstanceName = map.get("instanceName");

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

/**
 * Instantiate a message with a new id
 * @param message message to be copied
 * @param id unique message identifier
 */
public Message(Message message, String id) {
 super(new ZNRecord(message.getRecord(), id));
 setMsgId(id);
}

代码示例来源:origin: com.linkedin.gobblin/gobblin-cluster

private List<Message> generateMessagesForController(Message message) {
 List<Message> messages = new ArrayList<Message>();
 String id = UUID.randomUUID().toString();
 Message newMessage = new Message(message.getRecord(), id);
 newMessage.setMsgId(id);
 newMessage.setSrcName(_manager.getInstanceName());
 newMessage.setTgtName("Controller");
 messages.add(newMessage);
 return messages;
}

代码示例来源:origin: org.apache.gobblin/gobblin-cluster

private List<Message> generateMessagesForController(Message message) {
 List<Message> messages = new ArrayList<Message>();
 String id = UUID.randomUUID().toString();
 Message newMessage = new Message(message.getRecord(), id);
 newMessage.setMsgId(id);
 newMessage.setSrcName(_manager.getInstanceName());
 newMessage.setTgtName("Controller");
 messages.add(newMessage);
 return messages;
}

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

@GET
@Path("{clusterId}/controller/messages/{messageId}")
public Response getClusterControllerMessages(@PathParam("clusterId") String clusterId, @PathParam("messageId") String messageId) {
 HelixDataAccessor dataAccessor = getDataAccssor(clusterId);
 Message message = dataAccessor.getProperty(
   dataAccessor.keyBuilder().controllerMessage(messageId));
 return JSONRepresentation(message.getRecord());
}

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

@GET
@Path("{instanceName}/messages/{messageId}")
public Response getMessageOnInstance(@PathParam("clusterId") String clusterId,
  @PathParam("instanceName") String instanceName,
  @PathParam("messageId") String messageId) throws IOException {
 HelixDataAccessor accessor = getDataAccssor(clusterId);
 Message message = accessor.getProperty(accessor.keyBuilder().message(instanceName, messageId));
 if (message != null) {
  return JSONRepresentation(message.getRecord());
 }
 return notFound();
}

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

public void postFaultInjectionMessage(String zkServer, String clusterName, String instanceName,
  String payloadString, String partition) {
 Message message = new Message("FaultInjection", UUID.randomUUID().toString());
 if (payloadString != null) {
  message.getRecord().setSimpleField("faultType", payloadString);
 }
 if (partition != null) {
  message.setPartitionName(partition);
 }
 post(zkServer, message, clusterName, instanceName);
}

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

public void postFaultInjectionMessage(String zkServer, String clusterName, String instanceName,
  String payloadString, String partition) {
 Message message = new Message("FaultInjection", UUID.randomUUID().toString());
 if (payloadString != null) {
  message.getRecord().setSimpleField("faultType", payloadString);
 }
 if (partition != null) {
  message.setPartitionName(partition);
 }
 post(zkServer, message, clusterName, instanceName);
}

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

@Override
public boolean createControllerMessage(Message message) {
 return _baseDataAccessor.create(PropertyPathBuilder.controllerMessage(_clusterName,
   message.getMsgId()),
   message.getRecord(), AccessOption.PERSISTENT);
}

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

@Override
 public void onError(Exception e, ErrorCode code, ErrorType type) {
  // TODO Auto-generated method stub
  _message.getRecord().setSimpleField("exception", e.getMessage());
 }
}

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

@Override
public boolean createControllerMessage(Message message) {
 return _baseDataAccessor.create(PropertyPathBuilder.controllerMessage(_clusterName,
   message.getMsgId()),
   message.getRecord(), AccessOption.PERSISTENT);
}

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

private List<Message> generateMessagesForController(Message message) {
 List<Message> messages = new ArrayList<Message>();
 String id = (message.getMsgId() == null) ? UUID.randomUUID().toString() : message.getMsgId();
 Message newMessage = new Message(message.getRecord(), id);
 newMessage.setMsgId(id);
 newMessage.setSrcName(_manager.getInstanceName());
 newMessage.setTgtName(InstanceType.CONTROLLER.name());
 messages.add(newMessage);
 return messages;
}

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

private List<Message> generateMessagesForController(Message message) {
 List<Message> messages = new ArrayList<Message>();
 String id = (message.getMsgId() == null) ? UUID.randomUUID().toString() : message.getMsgId();
 Message newMessage = new Message(message.getRecord(), id);
 newMessage.setMsgId(id);
 newMessage.setSrcName(_manager.getInstanceName());
 newMessage.setTgtName(InstanceType.CONTROLLER.name());
 messages.add(newMessage);
 return messages;
}

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

@Override
public void onReplyMessage(Message message) {
 // TODO Auto-generated method stub
 System.out.println("OnreplyMessage: "
   + message.getRecord().getMapField(Message.Attributes.MESSAGE_RESULT.toString())
     .get("ReplyMessage"));
 if (message.getRecord().getMapField(Message.Attributes.MESSAGE_RESULT.toString())
   .get("ReplyMessage") == null) {
 }
 _replyedMessageContents.add(message.getRecord()
   .getMapField(Message.Attributes.MESSAGE_RESULT.toString()).get("ReplyMessage"));
}

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

public void post(String zkServer, Message message, String clusterName, String instanceName) {
 ZkClient client = new ZkClient(zkServer);
 client.setZkSerializer(new ZNRecordSerializer());
 String path = PropertyPathBuilder.instanceMessage(clusterName, instanceName, message.getId());
 client.delete(path);
 ZNRecord record = client.readData(PropertyPathBuilder.liveInstance(clusterName, instanceName));
 message.setTgtSessionId(record.getSimpleField(LiveInstanceProperty.SESSION_ID.toString()));
 message.setTgtName(record.getId());
 // System.out.println(message);
 client.createPersistent(path, message.getRecord());
}

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

public void post(String zkServer, Message message, String clusterName, String instanceName) {
 HelixZkClient client = SharedZkClientFactory.getInstance().buildZkClient(new HelixZkClient.ZkConnectionConfig(
   zkServer));
 client.setZkSerializer(new ZNRecordSerializer());
 String path = PropertyPathBuilder.instanceMessage(clusterName, instanceName, message.getId());
 client.delete(path);
 ZNRecord record = client.readData(PropertyPathBuilder.liveInstance(clusterName, instanceName));
 message.setTgtSessionId(record.getSimpleField(LiveInstanceProperty.SESSION_ID.toString()));
 message.setTgtName(record.getId());
 // System.out.println(message);
 client.createPersistent(path, message.getRecord());
}

相关文章