com.taobao.metamorphosis
类 Message

java.lang.Object
  继承者 com.taobao.metamorphosis.Message
所有已实现的接口:
Serializable

public class Message
extends Object
implements Serializable

A message with topic and data,a string attribute is optional.

作者:
boyan, wuhua
另请参见:
序列化表格

构造方法摘要
Message(String topic, byte[] data)
           
Message(String topic, byte[] data, String attribute)
           
 
方法摘要
 boolean equals(Object obj)
           
 String getAttribute()
          Returns the message's attribute,may be null.
 byte[] getData()
          Returns message's payload
 long getId()
          Returns the message's id.If it was sent success,the message id would be returned by broker,otherwise is zero.
 Partition getPartition()
          Returns message's partition in broker,if it was sent fail,it would be null.
 String getTopic()
          Returns message's topic
 boolean hasAttribute()
          Returns whether the message has an attribute.
 int hashCode()
           
 boolean isOrdered()
          已过时。 
 boolean isReadOnly()
          Returns whether the message is readonly.
 void setAttribute(String attribute)
          Set message's attribute
 void setData(byte[] data)
          Set the message's payload
 void setReadOnly(boolean readOnly)
          Set the message to be readonly,but metamorphosis client and server could modify message's id,flag,partition.The readonly state is transient,it will not be persist in broker.
 void setRollbackOnly()
          Set message to be in rollback only state.The state is transient,it's only valid in current message instance.
 void setTopic(String topic)
          Set message's topic,if you want to send it,you must publish it at first with MessageProducer.
 
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

Message

public Message(String topic,
               byte[] data)

Message

public Message(String topic,
               byte[] data,
               String attribute)
方法详细信息

setRollbackOnly

public void setRollbackOnly()
Set message to be in rollback only state.The state is transient,it's only valid in current message instance.

从以下版本开始:
1.4.5

isReadOnly

public boolean isReadOnly()
Returns whether the message is readonly.

返回:
从以下版本开始:
1.4.4

setReadOnly

public void setReadOnly(boolean readOnly)
Set the message to be readonly,but metamorphosis client and server could modify message's id,flag,partition.The readonly state is transient,it will not be persist in broker.

参数:
readOnly -
从以下版本开始:
1.4.4

hasAttribute

public boolean hasAttribute()
Returns whether the message has an attribute.

返回:

isOrdered

@Deprecated
public boolean isOrdered()
已过时。 

Returns whether the message is in order,it is deprecated and will be removed in future version.

返回:

getId

public long getId()
Returns the message's id.If it was sent success,the message id would be returned by broker,otherwise is zero.

返回:

getAttribute

public String getAttribute()
Returns the message's attribute,may be null.

返回:

setAttribute

public void setAttribute(String attribute)
Set message's attribute

参数:
attribute -

setTopic

public void setTopic(String topic)
Set message's topic,if you want to send it,you must publish it at first with MessageProducer.

参数:
topic -
另请参见:
MessageProducer.publish(String)

setData

public void setData(byte[] data)
Set the message's payload

参数:
data -

getTopic

public String getTopic()
Returns message's topic

返回:

getData

public byte[] getData()
Returns message's payload

返回:

hashCode

public int hashCode()
覆盖:
Object 中的 hashCode

equals

public boolean equals(Object obj)
覆盖:
Object 中的 equals

getPartition

public Partition getPartition()
Returns message's partition in broker,if it was sent fail,it would be null.

返回:


Copyright © 2010–2013. All rights reserved.