public class Message extends Object implements Serializable
| 限定符和类型 | 类和说明 |
|---|---|
static class |
Message.SystemPropKey |
| 构造器和说明 |
|---|
Message() |
Message(String topic,
String tags,
byte[] body) |
Message(String topic,
String tag,
String key,
byte[] body) |
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
getBody() |
String |
getKey() |
String |
getMsgID() |
int |
getReconsumeTimes() |
long |
getStartDeliverTime() |
String |
getTag() |
String |
getTopic() |
Properties |
getUserProperties() |
String |
getUserProperties(String key) |
void |
putUserProperties(String key,
String value) |
void |
setBody(byte[] body) |
void |
setKey(String key) |
void |
setMsgID(String msgid) |
void |
setReconsumeTimes(int value) |
void |
setStartDeliverTime(long value)
设置消息的定时投递时间(绝对时间),最大延迟时间为7天.
|
void |
setTag(String tag) |
void |
setTopic(String topic) |
void |
setUserProperties(Properties userProperties) |
String |
toString() |
public String getTopic()
public void setTopic(String topic)
public String getTag()
public void setTag(String tag)
public String getKey()
public void setKey(String key)
public String getMsgID()
public void setMsgID(String msgid)
public Properties getUserProperties()
public void setUserProperties(Properties userProperties)
public byte[] getBody()
public void setBody(byte[] body)
public int getReconsumeTimes()
public void setReconsumeTimes(int value)
public long getStartDeliverTime()
public void setStartDeliverTime(long value)
例1: 延迟投递, 延迟3s投递, 设置为: System.currentTimeMillis() + 3000;
例2: 定时投递, 2016-02-01 11:30:00投递, 设置为: new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2016-02-01 11:30:00").getTime()
Copyright © 2012-2016. All Rights Reserved.