public class MessageImpl extends java.lang.Object implements ProtonJMessage
Message.Factory
DEFAULT_PRIORITY
Constructor and Description |
---|
MessageImpl()
Application code should use
Message.Factory.create() instead. |
MessageImpl(Header header,
DeliveryAnnotations deliveryAnnotations,
MessageAnnotations messageAnnotations,
Properties properties,
ApplicationProperties applicationProperties,
Section body,
Footer footer)
Application code should instead use
Message.Factory.create(Header, DeliveryAnnotations, MessageAnnotations, Properties, ApplicationProperties, Section, Footer) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
int |
decode(byte[] data,
int offset,
int length)
TODO describe what happens if the data does not represent a complete message.
|
void |
decode(java.nio.ByteBuffer buffer) |
void |
decode(ReadableBuffer buffer)
Decodes the Message from the given
ReadableBuffer . |
int |
encode(byte[] data,
int offset,
int length)
Encodes up to
length bytes of the message into the provided byte array,
starting at position offset . |
int |
encode(WritableBuffer buffer)
Encodes the current Message contents into the given
WritableBuffer instance. |
int |
encode2(byte[] data,
int offset,
int length) |
java.lang.String |
getAddress() |
ApplicationProperties |
getApplicationProperties() |
Section |
getBody() |
java.lang.String |
getContentEncoding() |
java.lang.String |
getContentType() |
java.lang.Object |
getCorrelationId() |
long |
getCreationTime() |
DeliveryAnnotations |
getDeliveryAnnotations() |
long |
getDeliveryCount() |
MessageError |
getError() |
long |
getExpiryTime() |
Footer |
getFooter() |
java.lang.String |
getGroupId() |
long |
getGroupSequence() |
Header |
getHeader() |
MessageAnnotations |
getMessageAnnotations() |
java.lang.Object |
getMessageId() |
short |
getPriority() |
Properties |
getProperties() |
java.lang.String |
getReplyTo() |
java.lang.String |
getReplyToGroupId() |
java.lang.String |
getSubject() |
long |
getTtl() |
byte[] |
getUserId() |
boolean |
isDurable() |
boolean |
isFirstAcquirer() |
void |
setAddress(java.lang.String to) |
void |
setApplicationProperties(ApplicationProperties applicationProperties) |
void |
setBody(Section body) |
void |
setContentEncoding(java.lang.String contentEncoding) |
void |
setContentType(java.lang.String contentType) |
void |
setCorrelationId(java.lang.Object correlationId) |
void |
setCreationTime(long creationTime) |
void |
setDeliveryAnnotations(DeliveryAnnotations deliveryAnnotations) |
void |
setDeliveryCount(long deliveryCount) |
void |
setDurable(boolean durable) |
void |
setExpiryTime(long absoluteExpiryTime) |
void |
setFirstAcquirer(boolean firstAcquirer) |
void |
setFooter(Footer footer) |
void |
setGroupId(java.lang.String groupId) |
void |
setGroupSequence(long groupSequence) |
void |
setHeader(Header header) |
void |
setMessageAnnotations(MessageAnnotations messageAnnotations) |
void |
setMessageId(java.lang.Object messageId) |
void |
setPriority(short priority) |
void |
setProperties(Properties properties) |
void |
setReplyTo(java.lang.String replyTo) |
void |
setReplyToGroupId(java.lang.String replyToGroupId) |
void |
setSubject(java.lang.String subject) |
void |
setTtl(long ttl) |
void |
setUserId(byte[] userId) |
java.lang.String |
toString() |
public MessageImpl()
Message.Factory.create()
instead.public MessageImpl(Header header, DeliveryAnnotations deliveryAnnotations, MessageAnnotations messageAnnotations, Properties properties, ApplicationProperties applicationProperties, Section body, Footer footer)
Message.Factory.create(Header, DeliveryAnnotations, MessageAnnotations, Properties, ApplicationProperties, Section, Footer)
public long getDeliveryCount()
getDeliveryCount
in interface Message
public short getPriority()
getPriority
in interface Message
public boolean isFirstAcquirer()
isFirstAcquirer
in interface Message
public void setDurable(boolean durable)
setDurable
in interface Message
public void setDeliveryCount(long deliveryCount)
setDeliveryCount
in interface Message
public void setFirstAcquirer(boolean firstAcquirer)
setFirstAcquirer
in interface Message
public void setPriority(short priority)
setPriority
in interface Message
public java.lang.Object getMessageId()
getMessageId
in interface Message
public long getGroupSequence()
getGroupSequence
in interface Message
public java.lang.String getReplyToGroupId()
getReplyToGroupId
in interface Message
public long getCreationTime()
getCreationTime
in interface Message
public java.lang.String getAddress()
getAddress
in interface Message
public java.lang.String getReplyTo()
getReplyTo
in interface Message
public java.lang.String getGroupId()
getGroupId
in interface Message
public java.lang.String getContentType()
getContentType
in interface Message
public long getExpiryTime()
getExpiryTime
in interface Message
public java.lang.Object getCorrelationId()
getCorrelationId
in interface Message
public java.lang.String getContentEncoding()
getContentEncoding
in interface Message
public java.lang.String getSubject()
getSubject
in interface Message
public void setGroupSequence(long groupSequence)
setGroupSequence
in interface Message
public void setCreationTime(long creationTime)
setCreationTime
in interface Message
public void setSubject(java.lang.String subject)
setSubject
in interface Message
public void setGroupId(java.lang.String groupId)
setGroupId
in interface Message
public void setAddress(java.lang.String to)
setAddress
in interface Message
public void setExpiryTime(long absoluteExpiryTime)
setExpiryTime
in interface Message
public void setReplyToGroupId(java.lang.String replyToGroupId)
setReplyToGroupId
in interface Message
public void setContentEncoding(java.lang.String contentEncoding)
setContentEncoding
in interface Message
public void setContentType(java.lang.String contentType)
setContentType
in interface Message
public void setReplyTo(java.lang.String replyTo)
setReplyTo
in interface Message
public void setCorrelationId(java.lang.Object correlationId)
setCorrelationId
in interface Message
public void setMessageId(java.lang.Object messageId)
setMessageId
in interface Message
public DeliveryAnnotations getDeliveryAnnotations()
getDeliveryAnnotations
in interface Message
public MessageAnnotations getMessageAnnotations()
getMessageAnnotations
in interface Message
public Properties getProperties()
getProperties
in interface Message
public ApplicationProperties getApplicationProperties()
getApplicationProperties
in interface Message
public void setDeliveryAnnotations(DeliveryAnnotations deliveryAnnotations)
setDeliveryAnnotations
in interface Message
public void setMessageAnnotations(MessageAnnotations messageAnnotations)
setMessageAnnotations
in interface Message
public void setProperties(Properties properties)
setProperties
in interface Message
public void setApplicationProperties(ApplicationProperties applicationProperties)
setApplicationProperties
in interface Message
public int decode(byte[] data, int offset, int length)
Message
public void decode(java.nio.ByteBuffer buffer)
public void decode(ReadableBuffer buffer)
Message
ReadableBuffer
.
If the buffer given does not contain the fully encoded Message bytes for decode this method will throw an exception to indicate the buffer underflow condition and the message object will be left in an undefined state.
decode
in interface Message
buffer
- A ReadableBuffer
that contains the complete message bytes.public int encode(byte[] data, int offset, int length)
Message
length
bytes of the message into the provided byte array,
starting at position offset
.
TODO describe what happens if length is smaller than the encoded form, Currently
Proton-J throws an exception. What does Proton-C do?public int encode2(byte[] data, int offset, int length)
encode2
in interface ProtonJMessage
public int encode(WritableBuffer buffer)
Message
WritableBuffer
instance.
This method attempts to encode all message data into the WritableBuffer
and
if the buffer has insufficient space it will throw an exception to indicate the buffer
overflow condition. If successful the method returns the number of bytes written to
the provided buffer to fully encode the message.
encode
in interface Message
encode
in interface ProtonJMessage
buffer
- The WritableBuffer
instance to encode the message contents into.public MessageError getError()
public java.lang.String toString()
toString
in class java.lang.Object