public abstract class MessageImpl extends Object implements MessageInternal
All messages handled by ActiveMQ Artemis core are of this type
Modifier and Type | Field and Description |
---|---|
protected SimpleString |
address |
static int |
BODY_OFFSET |
protected ResetLimitWrappedActiveMQBuffer |
bodyBuffer |
protected ActiveMQBuffer |
buffer |
static int |
BUFFER_HEADER_SPACE |
protected boolean |
bufferValid |
protected boolean |
durable |
static SimpleString |
HDR_BRIDGE_DUPLICATE_ID |
static SimpleString |
HDR_ROUTE_TO_ACK_IDS |
static SimpleString |
HDR_ROUTE_TO_IDS |
static SimpleString |
HDR_SCALEDOWN_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_ORIGINAL_QUEUE, 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 ActiveMQBuffer.
|
protected |
MessageImpl(int initialMessageBufferSize) |
protected |
MessageImpl(MessageImpl other) |
protected |
MessageImpl(MessageImpl other,
TypedProperties properties) |
Modifier and Type | Method and Description |
---|---|
void |
bodyChanged() |
String |
bodyToString()
Debug Helper!!!!
I'm leaving this message here without any callers for a reason:
During debugs it's important eventually to identify what's on the bodies, and this method will give you a good idea about them.
|
void |
checkCompletion() |
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) |
void |
createBody(int initialMessageBufferSize) |
void |
decode(ActiveMQBuffer buff) |
void |
decodeFromBuffer(ActiveMQBuffer buffer) |
void |
decodeHeadersAndProperties(ActiveMQBuffer buffer) |
void |
encode(ActiveMQBuffer buff) |
void |
encodeHeadersAndProperties(ActiveMQBuffer buffer) |
boolean |
equals(Object other) |
SimpleString |
getAddress()
this doesn't need to be synchronized as setAddress is protecting the buffer,
not the address
|
ActiveMQBuffer |
getBodyBuffer()
Returns the message body as an ActiveMQBuffer
|
ActiveMQBuffer |
getBodyBufferDuplicate()
Returns a copy of the message body as an ActiveMQBuffer.
|
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) |
ActiveMQBuffer |
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.
|
TypedProperties |
getProperties() |
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
|
ActiveMQBuffer |
getWholeBuffer() |
int |
hashCode() |
boolean |
isDurable()
Returns whether this message is durable or not.
|
boolean |
isExpired()
Returns whether this message is expired or not.
|
Message |
putBooleanProperty(SimpleString key,
boolean value)
Puts a boolean property in this message.
|
Message |
putBooleanProperty(String key,
boolean value) |
Message |
putByteProperty(SimpleString key,
byte value)
Puts a byte property in this message.
|
Message |
putByteProperty(String key,
byte value) |
Message |
putBytesProperty(SimpleString key,
byte[] value)
Puts a byte[] property in this message.
|
Message |
putBytesProperty(String key,
byte[] value) |
Message |
putCharProperty(SimpleString key,
char value)
Puts a char property in this message.
|
Message |
putCharProperty(String key,
char value) |
Message |
putDoubleProperty(SimpleString key,
double value)
Puts a double property in this message.
|
Message |
putDoubleProperty(String key,
double value) |
Message |
putFloatProperty(SimpleString key,
float value)
Puts a float property in this message.
|
Message |
putFloatProperty(String key,
float value) |
Message |
putIntProperty(SimpleString key,
int value)
Puts an int property in this message.
|
Message |
putIntProperty(String key,
int value) |
Message |
putLongProperty(SimpleString key,
long value)
Puts a long property in this message.
|
Message |
putLongProperty(String key,
long value) |
Message |
putObjectProperty(SimpleString key,
Object value)
Puts an Object property in this message.
|
Message |
putObjectProperty(String key,
Object value) |
Message |
putShortProperty(SimpleString key,
short value)
Puts a short property in this message.
|
Message |
putShortProperty(String key,
short value) |
Message |
putStringProperty(SimpleString key,
SimpleString value)
Puts a SimpleString property in this message.
|
Message |
putStringProperty(String key,
String value)
Puts a String property in this message.
|
Message |
putTypedProperties(TypedProperties otherProps) |
Object |
removeProperty(SimpleString key)
Removes the property corresponding to the specified key.
|
Object |
removeProperty(String key) |
Message |
setAddress(SimpleString address)
The only reason this is synchronized is because of encoding a message versus invalidating the buffer.
|
void |
setAddressTransient(SimpleString address) |
MessageImpl |
setDurable(boolean durable)
Sets whether this message is durable or not.
|
MessageImpl |
setExpiration(long expiration)
Sets the expiration of this message.
|
MessageImpl |
setPriority(byte priority)
Sets the message priority.
|
MessageImpl |
setTimestamp(long timestamp)
Sets the message timestamp.
|
void |
setType(byte type) |
MessageImpl |
setUserID(UUID userID)
Sets the user ID
|
Map<String,Object> |
toMap() |
Message |
writeBodyBufferBytes(byte[] bytes)
Writes the input byte array to the message body ActiveMQBuffer
|
Message |
writeBodyBufferString(String string)
Writes the input String to the message body ActiveMQBuffer
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getBodyInputStream, isServerMessage
isLargeMessage
public static final SimpleString HDR_ROUTE_TO_IDS
public static final SimpleString HDR_SCALEDOWN_TO_IDS
public static final SimpleString HDR_ROUTE_TO_ACK_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 timestamp
protected TypedProperties properties
protected byte priority
protected ActiveMQBuffer buffer
protected ResetLimitWrappedActiveMQBuffer 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(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(ActiveMQBuffer buffer)
encodeHeadersAndProperties
in interface MessageInternal
public void decodeHeadersAndProperties(ActiveMQBuffer buffer)
decodeHeadersAndProperties
in interface MessageInternal
public void copyHeadersAndProperties(MessageInternal msg)
public ActiveMQBuffer getBodyBuffer()
Message
getBodyBuffer
in interface Message
public Message writeBodyBufferBytes(byte[] bytes)
Message
writeBodyBufferBytes
in interface Message
public Message writeBodyBufferString(String string)
Message
writeBodyBufferString
in interface Message
public void checkCompletion() throws ActiveMQException
ActiveMQException
public ActiveMQBuffer getBodyBufferDuplicate()
Message
getBodyBufferDuplicate
in interface Message
public long getMessageID()
Message
getMessageID
in interface Message
public UUID getUserID()
Message
public MessageImpl setUserID(UUID userID)
Message
public SimpleString getAddress()
getAddress
in interface Message
public Message setAddress(SimpleString address)
setAddress
in interface Message
address
- address to send the message topublic byte getType()
Message
See fields *_TYPE for possible values.
public void setType(byte type)
public boolean isDurable()
Message
public MessageImpl 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 MessageImpl setExpiration(long expiration)
Message
setExpiration
in interface Message
expiration
- expiration timepublic long getTimestamp()
Message
getTimestamp
in interface Message
public MessageImpl setTimestamp(long timestamp)
Message
setTimestamp
in interface Message
timestamp
- timestamppublic byte getPriority()
Message
Values range from 0 (less priority) to 9 (more priority) inclusive.
getPriority
in interface Message
public MessageImpl setPriority(byte priority)
Message
Value must be between 0 and 9 inclusive.
setPriority
in interface Message
priority
- the new message prioritypublic boolean isExpired()
Message
public void decodeFromBuffer(ActiveMQBuffer buffer)
decodeFromBuffer
in interface MessageInternal
public void bodyChanged()
bodyChanged
in interface MessageInternal
public int getEndOfMessagePosition()
getEndOfMessagePosition
in interface MessageInternal
public int getEndOfBodyPosition()
getEndOfBodyPosition
in interface MessageInternal
public void encode(ActiveMQBuffer buff)
public void decode(ActiveMQBuffer buff)
public ActiveMQBuffer getEncodedBuffer()
getEncodedBuffer
in interface MessageInternal
public void setAddressTransient(SimpleString address)
setAddressTransient
in interface MessageInternal
public Message putBooleanProperty(SimpleString key, boolean value)
Message
putBooleanProperty
in interface Message
key
- property namevalue
- property valuepublic Message putByteProperty(SimpleString key, byte value)
Message
putByteProperty
in interface Message
key
- property namevalue
- property valuepublic Message putBytesProperty(SimpleString key, byte[] value)
Message
putBytesProperty
in interface Message
key
- property namevalue
- property valuepublic Message putCharProperty(SimpleString key, char value)
Message
putCharProperty
in interface Message
key
- property namevalue
- property valuepublic Message putCharProperty(String key, char value)
putCharProperty
in interface Message
Message.putCharProperty(SimpleString, char)
public Message putShortProperty(SimpleString key, short value)
Message
putShortProperty
in interface Message
key
- property namevalue
- property valuepublic Message putIntProperty(SimpleString key, int value)
Message
putIntProperty
in interface Message
key
- property namevalue
- property valuepublic Message putLongProperty(SimpleString key, long value)
Message
putLongProperty
in interface Message
key
- property namevalue
- property valuepublic Message putFloatProperty(SimpleString key, float value)
Message
putFloatProperty
in interface Message
key
- property namevalue
- property valuepublic Message putDoubleProperty(SimpleString key, double value)
Message
putDoubleProperty
in interface Message
key
- property namevalue
- property valuepublic Message putStringProperty(SimpleString key, SimpleString value)
Message
putStringProperty
in interface Message
key
- property namevalue
- property valuepublic Message putObjectProperty(SimpleString key, Object value) throws ActiveMQPropertyConversionException
Message
putObjectProperty
in interface Message
key
- property namevalue
- property valueActiveMQPropertyConversionException
- if the value is not one of the accepted property
types.public Message putObjectProperty(String key, Object value) throws ActiveMQPropertyConversionException
putObjectProperty
in interface Message
ActiveMQPropertyConversionException
Message.putObjectProperty(SimpleString, Object)
public Message putBooleanProperty(String key, boolean value)
putBooleanProperty
in interface Message
Message.putBooleanProperty(SimpleString, boolean)
public Message putByteProperty(String key, byte value)
putByteProperty
in interface Message
Message.putByteProperty(SimpleString, byte)
public Message putBytesProperty(String key, byte[] value)
putBytesProperty
in interface Message
Message.putBytesProperty(SimpleString, byte[])
public Message putShortProperty(String key, short value)
putShortProperty
in interface Message
Message.putShortProperty(SimpleString, short)
public Message putIntProperty(String key, int value)
putIntProperty
in interface Message
Message.putIntProperty(SimpleString, int)
public Message putLongProperty(String key, long value)
putLongProperty
in interface Message
Message.putLongProperty(SimpleString, long)
public Message putFloatProperty(String key, float value)
putFloatProperty
in interface Message
Message.putFloatProperty(SimpleString, float)
public Message putDoubleProperty(String key, double value)
putDoubleProperty
in interface Message
Message.putDoubleProperty(SimpleString, double)
public Message putStringProperty(String key, String value)
Message
putStringProperty
in interface Message
key
- property namevalue
- property valuepublic Message putTypedProperties(TypedProperties otherProps)
public Object getObjectProperty(SimpleString key)
Message
getObjectProperty
in interface Message
public Boolean getBooleanProperty(SimpleString key) throws ActiveMQPropertyConversionException
Message
getBooleanProperty
in interface Message
ActiveMQPropertyConversionException
- if the value can not be converted to a Booleanpublic Boolean getBooleanProperty(String key) throws ActiveMQPropertyConversionException
getBooleanProperty
in interface Message
ActiveMQPropertyConversionException
Message.getBooleanProperty(SimpleString)
public Byte getByteProperty(SimpleString key) throws ActiveMQPropertyConversionException
Message
getByteProperty
in interface Message
ActiveMQPropertyConversionException
- if the value can not be converted to a Bytepublic Byte getByteProperty(String key) throws ActiveMQPropertyConversionException
getByteProperty
in interface Message
ActiveMQPropertyConversionException
Message.getByteProperty(SimpleString)
public byte[] getBytesProperty(SimpleString key) throws ActiveMQPropertyConversionException
Message
getBytesProperty
in interface Message
ActiveMQPropertyConversionException
- if the value can not be converted to a byte[]public byte[] getBytesProperty(String key) throws ActiveMQPropertyConversionException
getBytesProperty
in interface Message
ActiveMQPropertyConversionException
Message.getBytesProperty(SimpleString)
public Double getDoubleProperty(SimpleString key) throws ActiveMQPropertyConversionException
Message
getDoubleProperty
in interface Message
ActiveMQPropertyConversionException
- if the value can not be converted to a Doublepublic Double getDoubleProperty(String key) throws ActiveMQPropertyConversionException
getDoubleProperty
in interface Message
ActiveMQPropertyConversionException
Message.getDoubleProperty(SimpleString)
public Integer getIntProperty(SimpleString key) throws ActiveMQPropertyConversionException
Message
getIntProperty
in interface Message
ActiveMQPropertyConversionException
- if the value can not be converted to an Integerpublic Integer getIntProperty(String key) throws ActiveMQPropertyConversionException
getIntProperty
in interface Message
ActiveMQPropertyConversionException
Message.getIntProperty(SimpleString)
public Long getLongProperty(SimpleString key) throws ActiveMQPropertyConversionException
Message
getLongProperty
in interface Message
ActiveMQPropertyConversionException
- if the value can not be converted to a Longpublic Long getLongProperty(String key) throws ActiveMQPropertyConversionException
getLongProperty
in interface Message
ActiveMQPropertyConversionException
Message.getLongProperty(SimpleString)
public Short getShortProperty(SimpleString key) throws ActiveMQPropertyConversionException
Message
getShortProperty
in interface Message
ActiveMQPropertyConversionException
- if the value can not be converted to a Shortpublic Short getShortProperty(String key) throws ActiveMQPropertyConversionException
getShortProperty
in interface Message
ActiveMQPropertyConversionException
Message.getShortProperty(SimpleString)
public Float getFloatProperty(SimpleString key) throws ActiveMQPropertyConversionException
Message
getFloatProperty
in interface Message
ActiveMQPropertyConversionException
- if the value can not be converted to a Floatpublic Float getFloatProperty(String key) throws ActiveMQPropertyConversionException
getFloatProperty
in interface Message
ActiveMQPropertyConversionException
Message.getFloatProperty(SimpleString)
public String getStringProperty(SimpleString key) throws ActiveMQPropertyConversionException
Message
getStringProperty
in interface Message
ActiveMQPropertyConversionException
- if the value can not be converted to a Stringpublic String getStringProperty(String key) throws ActiveMQPropertyConversionException
getStringProperty
in interface Message
ActiveMQPropertyConversionException
Message.getStringProperty(SimpleString)
public SimpleString getSimpleStringProperty(SimpleString key) throws ActiveMQPropertyConversionException
Message
getSimpleStringProperty
in interface Message
ActiveMQPropertyConversionException
- if the value can not be converted to a SimpleStringpublic SimpleString getSimpleStringProperty(String key) throws ActiveMQPropertyConversionException
getSimpleStringProperty
in interface Message
ActiveMQPropertyConversionException
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 ActiveMQBuffer getWholeBuffer()
getWholeBuffer
in interface MessageInternal
public BodyEncoder getBodyEncoder() throws ActiveMQException
getBodyEncoder
in interface MessageInternal
ActiveMQException
public TypedProperties getTypedProperties()
getTypedProperties
in interface MessageInternal
public String bodyToString()
public TypedProperties getProperties()
public void createBody(int initialMessageBufferSize)
Copyright © 2016 JBoss by Red Hat. All rights reserved.