/** * Instantiate a message * * @param type {@link MessageType} as a string or a custom message type * @param msgId unique message identifier */ public Message(String type, MessageId msgId) { super(new ZNRecord(msgId.stringify())); _record.setSimpleField(Attributes.MSG_TYPE.toString(), type); setMessageId(msgId); setMsgState(MessageState.NEW); _record.setLongField(Attributes.CREATE_TIMESTAMP.toString(), new Date().getTime()); }
/** * Get the type of this message * * @return String {@link MessageType} or a custom message type */ public String getMsgType() { return _record.getSimpleField(Attributes.MSG_TYPE.toString()); }
/** * Set the type of this message * * @param type {@link MessageType} */ void setMsgType(MessageType type) { _record.setSimpleField(Attributes.MSG_TYPE.toString(), type.toString()); }