/** * 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()); }
/** * Set the unique identifier of this message * * @param msgId message identifier */ public void setMessageId(MessageId msgId) { if (msgId != null) { setMsgId(msgId.stringify()); } }
/** * Instantiate a message with a new id * * @param record a ZNRecord corresponding to a message * @param id unique message identifier */ public Message(ZNRecord record, MessageId id) { super(new ZNRecord(record, id.stringify())); setMessageId(id); }