Example #1
0
  /**
   * Convert a string map to a message
   *
   * @param msgStrMap
   * @return message
   */
  public static Message toMessage(Map<String, String> msgStrMap) {
    String msgId = msgStrMap.get(Attributes.MSG_ID.name());
    if (msgId == null) {
      throw new IllegalArgumentException("Missing msgId in message string map: " + msgStrMap);
    }

    ZNRecord record = new ZNRecord(msgId);
    record.getSimpleFields().putAll(msgStrMap);
    return new Message(record);
  }
Example #2
0
 /**
  * Set the unique identifier of this message
  *
  * @param msgId message identifier
  */
 public void setMsgId(String msgId) {
   _record.setSimpleField(Attributes.MSG_ID.toString(), msgId);
 }
Example #3
0
 /**
  * Get the unique identifier of this message
  *
  * @return message identifier
  */
 public String getMsgId() {
   return _record.getSimpleField(Attributes.MSG_ID.toString());
 }