Ejemplo n.º 1
0
 /**
  * Create a reply based on an incoming message
  *
  * @param srcMessage the incoming message
  * @param instanceName the instance that is the source of the reply
  * @param taskResultMap the result of executing the incoming message
  * @return the reply Message
  */
 public static Message createReplyMessage(
     Message srcMessage, String instanceName, Map<String, String> taskResultMap) {
   if (srcMessage.getCorrelationId() == null) {
     throw new HelixException(
         "Message " + srcMessage.getMessageId() + " does not contain correlation id");
   }
   Message replyMessage =
       new Message(MessageType.TASK_REPLY, MessageId.from(UUID.randomUUID().toString()));
   replyMessage.setCorrelationId(srcMessage.getCorrelationId());
   replyMessage.setResultMap(taskResultMap);
   replyMessage.setTgtSessionId(SessionId.from("*"));
   replyMessage.setMsgState(MessageState.NEW);
   replyMessage.setSrcName(instanceName);
   if (srcMessage.getSrcInstanceType() == InstanceType.CONTROLLER) {
     replyMessage.setTgtName("Controller");
   } else {
     replyMessage.setTgtName(srcMessage.getMsgSrc());
   }
   return replyMessage;
 }
Ejemplo n.º 2
0
 /**
  * Set the session identifier of the node that executes the message
  *
  * @param exeSessionId session identifier
  */
 public void setExecuteSessionId(SessionId exeSessionId) {
   if (exeSessionId != null) {
     setExecuteSessionId(exeSessionId.stringify());
   }
 }
Ejemplo n.º 3
0
 /**
  * Get the session identifier of the node that executes the message
  *
  * @return session identifier
  */
 public SessionId getTypedExecutionSessionId() {
   return SessionId.from(getExecutionSessionId());
 }
Ejemplo n.º 4
0
 /**
  * Set the session identifier of the source node
  *
  * @param srcSessionId session identifier
  */
 public void setSrcSessionId(SessionId srcSessionId) {
   if (srcSessionId != null) {
     setSrcSessionId(srcSessionId.stringify());
   }
 }
Ejemplo n.º 5
0
 /**
  * Get the session identifier of the source node
  *
  * @return session identifier
  */
 public SessionId getTypedSrcSessionId() {
   return SessionId.from(getSrcSessionId());
 }
Ejemplo n.º 6
0
 /**
  * Set the session identifier of the destination node
  *
  * @param tgtSessionId session identifier
  */
 public void setTgtSessionId(SessionId tgtSessionId) {
   if (tgtSessionId != null) {
     setTgtSessionId(tgtSessionId.stringify());
   }
 }
Ejemplo n.º 7
0
 /**
  * Get the session identifier of the destination node
  *
  * @return session identifier
  */
 public SessionId getTypedTgtSessionId() {
   return SessionId.from(getTgtSessionId());
 }