Exemplo n.º 1
0
 /**
  * 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());
 }
Exemplo n.º 2
0
 /**
  * Instantiate a message
  *
  * @param record a ZNRecord corresponding to a message
  */
 public Message(ZNRecord record) {
   super(record);
   if (getMsgState() == null) {
     setMsgState(MessageState.NEW);
   }
   if (getCreateTimeStamp() == 0) {
     _record.setLongField(Attributes.CREATE_TIMESTAMP.toString(), new Date().getTime());
   }
 }
Exemplo n.º 3
0
 /**
  * Get the time that this message was created
  *
  * @return UNIX timestamp
  */
 public long getCreateTimeStamp() {
   return _record.getLongField(Attributes.CREATE_TIMESTAMP.toString(), 0L);
 }
Exemplo n.º 4
0
 /**
  * Set the time that the message was created
  *
  * @param timestamp a UNIX timestamp
  */
 public void setCreateTimeStamp(long timestamp) {
   _record.setLongField(Attributes.CREATE_TIMESTAMP.toString(), timestamp);
 }