public abstract class MessageImpl extends Object implements MessageInternal
Modifier and Type | Field and Description |
---|---|
protected SimpleString |
address |
static int |
BODY_OFFSET |
protected ResetLimitWrappedHornetQBuffer |
bodyBuffer |
protected HornetQBuffer |
buffer |
static int |
BUFFER_HEADER_SPACE |
protected boolean |
bufferValid |
protected boolean |
durable |
protected long |
expiration
GMT milliseconds at which this message expires.
|
static SimpleString |
HDR_BRIDGE_DUPLICATE_ID |
static SimpleString |
HDR_ROUTE_TO_IDS |
protected long |
messageID |
protected byte |
priority |
protected TypedProperties |
properties |
protected long |
timestamp |
protected byte |
type |
BYTES_TYPE, DEFAULT_TYPE, HDR_ACTUAL_EXPIRY_TIME, HDR_DUPLICATE_DETECTION_ID, HDR_GROUP_ID, HDR_LARGE_BODY_SIZE, HDR_LARGE_COMPRESSED, HDR_LAST_VALUE_NAME, HDR_ORIG_MESSAGE_ID, HDR_ORIGINAL_ADDRESS, HDR_SCHEDULED_DELIVERY_TIME, MAP_TYPE, OBJECT_TYPE, STREAM_TYPE, TEXT_TYPE
Modifier | Constructor and Description |
---|---|
protected |
MessageImpl() |
protected |
MessageImpl(byte type,
boolean durable,
long expiration,
long timestamp,
byte priority,
int initialMessageBufferSize)
overridden by the client message, we need access to the connection so we can create the appropriate HornetQBuffer.
|
protected |
MessageImpl(int initialMessageBufferSize) |
protected |
MessageImpl(long messageID,
int initialMessageBufferSize) |
protected |
MessageImpl(MessageImpl other) |
protected |
MessageImpl(MessageImpl other,
TypedProperties properties) |
Modifier and Type | Method and Description |
---|---|
void |
bodyChanged() |
void |
checkCopy() |
boolean |
containsProperty(SimpleString key)
Returns
true if this message contains a property with the given key, false else. |
boolean |
containsProperty(String key) |
void |
copyHeadersAndProperties(MessageInternal msg) |
protected void |
createBody(int initialMessageBufferSize) |
void |
decode(HornetQBuffer buff) |
void |
decodeFromBuffer(HornetQBuffer buffer) |
void |
decodeHeadersAndProperties(HornetQBuffer buffer) |
void |
encode(HornetQBuffer buff) |
void |
encodeHeadersAndProperties(HornetQBuffer buffer) |
SimpleString |
getAddress()
Returns the address this message is sent to.
|
HornetQBuffer |
getBodyBuffer()
Returns the message body as a HornetQBuffer
|
BodyEncoder |
getBodyEncoder() |
Boolean |
getBooleanProperty(SimpleString key)
Returns the property corresponding to the specified key as a Boolean.
|
Boolean |
getBooleanProperty(String key) |
Byte |
getByteProperty(SimpleString key)
Returns the property corresponding to the specified key as a Byte.
|
Byte |
getByteProperty(String key) |
byte[] |
getBytesProperty(SimpleString key)
Returns the property corresponding to the specified key as a byte[].
|
byte[] |
getBytesProperty(String key) |
Double |
getDoubleProperty(SimpleString key)
Returns the property corresponding to the specified key as a Double.
|
Double |
getDoubleProperty(String key) |
HornetQBuffer |
getEncodedBuffer() |
int |
getEncodeSize()
Returns the size of the encoded message.
|
int |
getEndOfBodyPosition() |
int |
getEndOfMessagePosition() |
long |
getExpiration()
Returns the expiration time of this message.
|
Float |
getFloatProperty(SimpleString key)
Returns the property corresponding to the specified key as a Float.
|
Float |
getFloatProperty(String key) |
int |
getHeadersAndPropertiesEncodeSize() |
Integer |
getIntProperty(SimpleString key)
Returns the property corresponding to the specified key as an Integer.
|
Integer |
getIntProperty(String key) |
Long |
getLongProperty(SimpleString key)
Returns the property corresponding to the specified key as a Long.
|
Long |
getLongProperty(String key) |
long |
getMessageID()
Returns the messageID.
|
Object |
getObjectProperty(SimpleString key)
Returns the property corresponding to the specified key
|
Object |
getObjectProperty(String key) |
byte |
getPriority()
Returns the message priority.
|
Set<SimpleString> |
getPropertyNames()
Returns all the names of the properties for this message.
|
Short |
getShortProperty(SimpleString key)
Returns the property corresponding to the specified key as a Short.
|
Short |
getShortProperty(String key) |
SimpleString |
getSimpleStringProperty(SimpleString key)
Returns the property corresponding to the specified key as a SimpleString.
|
SimpleString |
getSimpleStringProperty(String key) |
String |
getStringProperty(SimpleString key)
Returns the property corresponding to the specified key as a String.
|
String |
getStringProperty(String key) |
long |
getTimestamp()
Returns the message timestamp.
|
byte |
getType()
Returns this message type.
|
TypedProperties |
getTypedProperties() |
UUID |
getUserID()
Returns the userID - this is an optional user specified UUID that can be set to identify the message
and will be passed around with the message
|
HornetQBuffer |
getWholeBuffer() |
boolean |
isDurable()
Returns whether this message is durable or not.
|
boolean |
isExpired()
Returns whether this message is expired or not.
|
void |
putBooleanProperty(SimpleString key,
boolean value)
Puts a boolean property in this message.
|
void |
putBooleanProperty(String key,
boolean value) |
void |
putByteProperty(SimpleString key,
byte value)
Puts a byte property in this message.
|
void |
putByteProperty(String key,
byte value) |
void |
putBytesProperty(SimpleString key,
byte[] value)
Puts a byte[] property in this message.
|
void |
putBytesProperty(String key,
byte[] value) |
void |
putDoubleProperty(SimpleString key,
double value)
Puts a double property in this message.
|
void |
putDoubleProperty(String key,
double value) |
void |
putFloatProperty(SimpleString key,
float value)
Puts a float property in this message.
|
void |
putFloatProperty(String key,
float value) |
void |
putIntProperty(SimpleString key,
int value)
Puts a int property in this message.
|
void |
putIntProperty(String key,
int value) |
void |
putLongProperty(SimpleString key,
long value)
Puts a long property in this message.
|
void |
putLongProperty(String key,
long value) |
void |
putObjectProperty(SimpleString key,
Object value)
Puts an Object property in this message.
|
void |
putObjectProperty(String key,
Object value) |
void |
putShortProperty(SimpleString key,
short value)
Puts a short property in this message.
|
void |
putShortProperty(String key,
short value) |
void |
putStringProperty(SimpleString key,
SimpleString value)
Puts a SimpleString property in this message.
|
void |
putStringProperty(String key,
String value)
Puts a String property in this message.
|
void |
putTypedProperties(TypedProperties otherProps) |
Object |
removeProperty(SimpleString key)
Removes the property corresponding to the specified key.
|
Object |
removeProperty(String key) |
void |
resetCopied() |
void |
setAddress(SimpleString address)
Sets the address to send this message to.
|
void |
setAddressTransient(SimpleString address) |
void |
setDurable(boolean durable)
Sets whether this message is durable or not.
|
void |
setExpiration(long expiration)
Sets the expiration of this message.
|
void |
setPriority(byte priority)
Sets the message priority.
|
void |
setTimestamp(long timestamp)
Sets the message timestamp.
|
void |
setType(byte type) |
void |
setUserID(UUID userID)
Sets the user ID
|
Map<String,Object> |
toMap() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBodyInputStream, isServerMessage
isLargeMessage
public static final SimpleString HDR_ROUTE_TO_IDS
public static final SimpleString HDR_BRIDGE_DUPLICATE_ID
public static final int BUFFER_HEADER_SPACE
public static final int BODY_OFFSET
protected long messageID
protected SimpleString address
protected byte type
protected boolean durable
protected long expiration
protected long timestamp
protected TypedProperties properties
protected byte priority
protected HornetQBuffer buffer
protected ResetLimitWrappedHornetQBuffer bodyBuffer
protected volatile boolean bufferValid
protected MessageImpl()
protected MessageImpl(byte type, boolean durable, long expiration, long timestamp, byte priority, int initialMessageBufferSize)
type
- durable
- expiration
- timestamp
- priority
- initialMessageBufferSize
- protected MessageImpl(long messageID, int initialMessageBufferSize)
protected MessageImpl(int initialMessageBufferSize)
protected MessageImpl(MessageImpl other)
protected MessageImpl(MessageImpl other, TypedProperties properties)
public int getEncodeSize()
Message
getEncodeSize
in interface Message
public int getHeadersAndPropertiesEncodeSize()
getHeadersAndPropertiesEncodeSize
in interface MessageInternal
public void encodeHeadersAndProperties(HornetQBuffer buffer)
encodeHeadersAndProperties
in interface MessageInternal
public void decodeHeadersAndProperties(HornetQBuffer buffer)
decodeHeadersAndProperties
in interface MessageInternal
public void copyHeadersAndProperties(MessageInternal msg)
public HornetQBuffer getBodyBuffer()
Message
getBodyBuffer
in interface Message
public long getMessageID()
Message
getMessageID
in interface Message
public UUID getUserID()
Message
public void setUserID(UUID userID)
Message
public SimpleString getAddress()
Message
getAddress
in interface Message
public void setAddress(SimpleString address)
Message
setAddress
in interface Message
address
- address to send the message topublic byte getType()
Message
public void setType(byte type)
public boolean isDurable()
Message
public void setDurable(boolean durable)
Message
setDurable
in interface Message
durable
- true
to flag this message as durable, false
elsepublic long getExpiration()
Message
getExpiration
in interface Message
public void setExpiration(long expiration)
Message
setExpiration
in interface Message
expiration
- expiration timepublic long getTimestamp()
Message
getTimestamp
in interface Message
public void setTimestamp(long timestamp)
Message
setTimestamp
in interface Message
timestamp
- timestamppublic byte getPriority()
Message
getPriority
in interface Message
public void setPriority(byte priority)
Message
setPriority
in interface Message
priority
- the new message prioritypublic boolean isExpired()
Message
public void decodeFromBuffer(HornetQBuffer buffer)
decodeFromBuffer
in interface MessageInternal
public void bodyChanged()
bodyChanged
in interface MessageInternal
public void checkCopy()
checkCopy
in interface MessageInternal
public void resetCopied()
resetCopied
in interface MessageInternal
public int getEndOfMessagePosition()
getEndOfMessagePosition
in interface MessageInternal
public int getEndOfBodyPosition()
getEndOfBodyPosition
in interface MessageInternal
public void encode(HornetQBuffer buff)
public void decode(HornetQBuffer buff)
public HornetQBuffer getEncodedBuffer()
getEncodedBuffer
in interface MessageInternal
public void setAddressTransient(SimpleString address)
setAddressTransient
in interface MessageInternal
public void putBooleanProperty(SimpleString key, boolean value)
Message
putBooleanProperty
in interface Message
key
- property namevalue
- property valuepublic void putByteProperty(SimpleString key, byte value)
Message
putByteProperty
in interface Message
key
- property namevalue
- property valuepublic void putBytesProperty(SimpleString key, byte[] value)
Message
putBytesProperty
in interface Message
key
- property namevalue
- property valuepublic void putShortProperty(SimpleString key, short value)
Message
putShortProperty
in interface Message
key
- property namevalue
- property valuepublic void putIntProperty(SimpleString key, int value)
Message
putIntProperty
in interface Message
key
- property namevalue
- property valuepublic void putLongProperty(SimpleString key, long value)
Message
putLongProperty
in interface Message
key
- property namevalue
- property valuepublic void putFloatProperty(SimpleString key, float value)
Message
putFloatProperty
in interface Message
key
- property namevalue
- property valuepublic void putDoubleProperty(SimpleString key, double value)
Message
putDoubleProperty
in interface Message
key
- property namevalue
- property valuepublic void putStringProperty(SimpleString key, SimpleString value)
Message
putStringProperty
in interface Message
key
- property namevalue
- property valuepublic void putObjectProperty(SimpleString key, Object value) throws PropertyConversionException
Message
putObjectProperty
in interface Message
key
- property namevalue
- property valuePropertyConversionException
- if the value is not one of the accepted property types.public void putObjectProperty(String key, Object value) throws PropertyConversionException
putObjectProperty
in interface Message
PropertyConversionException
Message.putObjectProperty(SimpleString, Object)
public void putBooleanProperty(String key, boolean value)
putBooleanProperty
in interface Message
Message.putBooleanProperty(SimpleString, boolean)
public void putByteProperty(String key, byte value)
putByteProperty
in interface Message
Message.putByteProperty(SimpleString, byte)
public void putBytesProperty(String key, byte[] value)
putBytesProperty
in interface Message
Message.putBytesProperty(SimpleString, byte[])
public void putShortProperty(String key, short value)
putShortProperty
in interface Message
Message.putShortProperty(SimpleString, short)
public void putIntProperty(String key, int value)
putIntProperty
in interface Message
Message.putIntProperty(SimpleString, int)
public void putLongProperty(String key, long value)
putLongProperty
in interface Message
Message.putLongProperty(SimpleString, long)
public void putFloatProperty(String key, float value)
putFloatProperty
in interface Message
Message.putFloatProperty(SimpleString, float)
public void putDoubleProperty(String key, double value)
putDoubleProperty
in interface Message
Message.putDoubleProperty(SimpleString, double)
public void putStringProperty(String key, String value)
Message
putStringProperty
in interface Message
key
- property namevalue
- property valuepublic void putTypedProperties(TypedProperties otherProps)
public Object getObjectProperty(SimpleString key)
Message
getObjectProperty
in interface Message
public Boolean getBooleanProperty(SimpleString key) throws PropertyConversionException
Message
getBooleanProperty
in interface Message
PropertyConversionException
- if the value can not be converted to a Booleanpublic Boolean getBooleanProperty(String key) throws PropertyConversionException
getBooleanProperty
in interface Message
PropertyConversionException
Message.getBooleanProperty(SimpleString)
public Byte getByteProperty(SimpleString key) throws PropertyConversionException
Message
getByteProperty
in interface Message
PropertyConversionException
- if the value can not be converted to a Bytepublic Byte getByteProperty(String key) throws PropertyConversionException
getByteProperty
in interface Message
PropertyConversionException
Message.getByteProperty(SimpleString)
public byte[] getBytesProperty(SimpleString key) throws PropertyConversionException
Message
getBytesProperty
in interface Message
PropertyConversionException
- if the value can not be converted to a byte[]public byte[] getBytesProperty(String key) throws PropertyConversionException
getBytesProperty
in interface Message
PropertyConversionException
Message.getBytesProperty(SimpleString)
public Double getDoubleProperty(SimpleString key) throws PropertyConversionException
Message
getDoubleProperty
in interface Message
PropertyConversionException
- if the value can not be converted to a Doublepublic Double getDoubleProperty(String key) throws PropertyConversionException
getDoubleProperty
in interface Message
PropertyConversionException
Message.getDoubleProperty(SimpleString)
public Integer getIntProperty(SimpleString key) throws PropertyConversionException
Message
getIntProperty
in interface Message
PropertyConversionException
- if the value can not be converted to an Integerpublic Integer getIntProperty(String key) throws PropertyConversionException
getIntProperty
in interface Message
PropertyConversionException
Message.getIntProperty(SimpleString)
public Long getLongProperty(SimpleString key) throws PropertyConversionException
Message
getLongProperty
in interface Message
PropertyConversionException
- if the value can not be converted to a Longpublic Long getLongProperty(String key) throws PropertyConversionException
getLongProperty
in interface Message
PropertyConversionException
Message.getLongProperty(SimpleString)
public Short getShortProperty(SimpleString key) throws PropertyConversionException
Message
getShortProperty
in interface Message
PropertyConversionException
- if the value can not be converted to a Shortpublic Short getShortProperty(String key) throws PropertyConversionException
getShortProperty
in interface Message
PropertyConversionException
Message.getShortProperty(SimpleString)
public Float getFloatProperty(SimpleString key) throws PropertyConversionException
Message
getFloatProperty
in interface Message
PropertyConversionException
- if the value can not be converted to a Floatpublic Float getFloatProperty(String key) throws PropertyConversionException
getFloatProperty
in interface Message
PropertyConversionException
Message.getFloatProperty(SimpleString)
public String getStringProperty(SimpleString key) throws PropertyConversionException
Message
getStringProperty
in interface Message
PropertyConversionException
- if the value can not be converted to a Stringpublic String getStringProperty(String key) throws PropertyConversionException
getStringProperty
in interface Message
PropertyConversionException
Message.getStringProperty(SimpleString)
public SimpleString getSimpleStringProperty(SimpleString key) throws PropertyConversionException
Message
getSimpleStringProperty
in interface Message
PropertyConversionException
- if the value can not be converted to a SimpleStringpublic SimpleString getSimpleStringProperty(String key) throws PropertyConversionException
getSimpleStringProperty
in interface Message
PropertyConversionException
Message.getSimpleStringProperty(SimpleString)
public Object getObjectProperty(String key)
getObjectProperty
in interface Message
Message.getBooleanProperty(SimpleString)
public Object removeProperty(SimpleString key)
Message
removeProperty
in interface Message
key
- property namepublic Object removeProperty(String key)
removeProperty
in interface Message
Message.removeProperty(SimpleString)
public boolean containsProperty(SimpleString key)
Message
true
if this message contains a property with the given key, false
else.containsProperty
in interface Message
key
- property namepublic boolean containsProperty(String key)
containsProperty
in interface Message
Message.containsProperty(SimpleString)
public Set<SimpleString> getPropertyNames()
Message
getPropertyNames
in interface Message
public HornetQBuffer getWholeBuffer()
getWholeBuffer
in interface MessageInternal
public BodyEncoder getBodyEncoder() throws HornetQException
getBodyEncoder
in interface MessageInternal
HornetQException
public TypedProperties getTypedProperties()
getTypedProperties
in interface MessageInternal
protected void createBody(int initialMessageBufferSize)
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.