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

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

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

Message.setSrcInstanceType介绍

[英]Set the type of instance that the source node is
[中]设置源节点所属实例的类型

代码示例

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

tempMessage.setRetryCount(retryCount);
tempMessage.setExecutionTimeout(timeOut);
tempMessage.setSrcInstanceType(_manager.getInstanceType());
if (correlationId != null) {
 tempMessage.setCorrelationId(correlationId);

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

tempMessage.setRetryCount(retryCount);
tempMessage.setExecutionTimeout(timeOut);
tempMessage.setSrcInstanceType(_manager.getInstanceType());
if (correlationId != null) {
 tempMessage.setCorrelationId(correlationId);

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

schedulerMessage.setSrcInstanceType(InstanceType.CONTROLLER);
String taskQueueName =
  ClusterRepresentationUtil.getFormJsonParameterString(form, TASKQUEUENAME);

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

private void sendReply(HelixDataAccessor replyDataAccessor, Message message,
  HelixTaskResult taskResult) {
 if (message.getCorrelationId() != null && !message.getMsgType()
   .equals(MessageType.TASK_REPLY.name())) {
  logger.info("Sending reply for message " + message.getCorrelationId());
  _statusUpdateUtil.logInfo(message, HelixTask.class, "Sending reply", _manager);
  taskResult.getTaskResultMap().put("SUCCESS", "" + taskResult.isSuccess());
  taskResult.getTaskResultMap().put("INTERRUPTED", "" + taskResult.isInterrupted());
  if (!taskResult.isSuccess()) {
   taskResult.getTaskResultMap().put("ERRORINFO", taskResult.getMessage());
  }
  Message replyMessage = Message
    .createReplyMessage(message, _manager.getInstanceName(), taskResult.getTaskResultMap());
  replyMessage.setSrcInstanceType(_manager.getInstanceType());
  Builder keyBuilder = replyDataAccessor.keyBuilder();
  if (message.getSrcInstanceType() == InstanceType.PARTICIPANT) {
   replyDataAccessor
     .setProperty(keyBuilder.message(message.getMsgSrc(), replyMessage.getMsgId()),
       replyMessage);
  } else if (message.getSrcInstanceType() == InstanceType.CONTROLLER) {
   replyDataAccessor
     .setProperty(keyBuilder.controllerMessage(replyMessage.getMsgId()), replyMessage);
  }
  _statusUpdateUtil.logInfo(message, HelixTask.class, String
    .format("1 msg replied to %s in cluster %s.", replyMessage.getTgtName(),
      message.getSrcClusterName() == null ?
        _manager.getClusterName() :
        message.getSrcClusterName()), _manager);
 }
}

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

private void sendReply(HelixDataAccessor accessor, Message message, HelixTaskResult taskResult) {
 if (_message.getCorrelationId() != null
   && !message.getMsgType().equals(MessageType.TASK_REPLY.name())) {
  logger.info("Sending reply for message " + message.getCorrelationId());
  _statusUpdateUtil.logInfo(message, HelixTask.class, "Sending reply", _manager);
  taskResult.getTaskResultMap().put("SUCCESS", "" + taskResult.isSuccess());
  taskResult.getTaskResultMap().put("INTERRUPTED", "" + taskResult.isInterrupted());
  if (!taskResult.isSuccess()) {
   taskResult.getTaskResultMap().put("ERRORINFO", taskResult.getMessage());
  }
  Message replyMessage =
    Message.createReplyMessage(_message, _manager.getInstanceName(),
      taskResult.getTaskResultMap());
  replyMessage.setSrcInstanceType(_manager.getInstanceType());
  if (message.getSrcInstanceType() == InstanceType.PARTICIPANT) {
   Builder keyBuilder = accessor.keyBuilder();
   accessor.setProperty(keyBuilder.message(message.getMsgSrc(), replyMessage.getMsgId()),
     replyMessage);
  } else if (message.getSrcInstanceType() == InstanceType.CONTROLLER) {
   Builder keyBuilder = accessor.keyBuilder();
   accessor.setProperty(keyBuilder.controllerMessage(replyMessage.getMsgId()), replyMessage);
  }
  _statusUpdateUtil.logInfo(message, HelixTask.class,
    "1 msg replied to " + replyMessage.getTgtName(), _manager);
 }
}

相关文章