public class AmqpJmsMessageFacade extends Object implements JmsMessageFacade
Modifier and Type | Field and Description |
---|---|
protected AmqpConnection |
connection |
protected org.apache.qpid.proton.message.Message |
message |
Constructor and Description |
---|
AmqpJmsMessageFacade(AmqpConnection connection)
Create a new AMQP Message Facade with an empty message instance.
|
AmqpJmsMessageFacade(AmqpConsumer consumer,
org.apache.qpid.proton.message.Message message)
Creates a new Facade around an incoming AMQP Message for dispatch to the
JMS Consumer instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
applicationPropertyExists(String key) |
void |
clearBody()
Clears the contents of this Message.
|
void |
clearProperties()
Clears any Message properties that exist for this Message instance.
|
AmqpJmsMessageFacade |
copy()
Create a new instance and perform a deep copy of this object's
contents.
|
protected void |
copyInto(AmqpJmsMessageFacade target) |
org.apache.qpid.proton.message.Message |
getAmqpMessage() |
long |
getAmqpTimeToLiveOverride() |
Object |
getApplicationProperty(String key) |
Set<String> |
getApplicationPropertyNames(Set<String> propertyNames) |
AmqpConnection |
getConnection()
The AmqpConnection instance that is associated with this Message.
|
String |
getContentType()
The annotation value for the JMS Message content type.
|
String |
getCorrelationId()
Returns the correlation ID set on this message if one exists, null otherwise.
|
byte[] |
getCorrelationIdBytes()
Gets the set correlation ID of the message in raw bytes form.
|
int |
getDeliveryCount()
Returns the current delivery count of the Message as set in the underlying
message instance.
|
JmsDestination |
getDestination()
Gets the Destination value that was assigned to this message at the time it was
sent.
|
long |
getExpiration()
Returns the set expiration time for this message.
|
String |
getGroupId()
Gets the Group ID that this message is assigned to.
|
int |
getGroupSequence()
Gets the assigned group sequence of this message.
|
byte |
getJmsMsgType() |
String |
getMessageId()
Returns the message ID set on this message if one exists, null otherwise.
|
int |
getPriority()
Returns the assigned priority value of this message in JMS ranged scoping.
|
Object |
getProperty(String key)
Returns the property stored in the message accessed via the given key/
|
Set<String> |
getPropertyNames()
Returns a set of all the property names that have been set in this message.
|
Object |
getProviderMessageIdObject()
Returns the underlying providers message ID object for this message if one
exists, null otherwise.
|
int |
getRedeliveryCount()
Returns the current redelivery count of the Message as set in the underlying
message instance.
|
JmsDestination |
getReplyTo()
Gets the Destination where replies for this Message are to be sent to.
|
String |
getReplyToGroupId() |
long |
getTimestamp()
Gets the timestamp assigned to the message when it was sent.
|
String |
getType()
Returns the JMSType value as defined by the provider or set by the sending client.
|
String |
getUserId()
Returns the ID of the user that sent this message if available.
|
byte[] |
getUserIdBytes()
Gets the set user ID of the message in raw bytes form.
|
boolean |
hasAmqpTimeToLiveOverride() |
boolean |
isPersistent() |
boolean |
isRedelivered()
Used to quickly check if a message has been redelivered.
|
void |
onDispatch()
Called before a message is dispatched to its intended consumer to allow for
any necessary processing of message data such as setting read-only state etc.
|
void |
onSend(long producerTtl)
Called before a message is sent to allow a Message instance to move the
contents from a logical data structure to a binary form for transmission, or
other processing such as setting proper message headers etc.
|
boolean |
propertyExists(String key) |
void |
setAmqpTimeToLiveOverride(Long ttl)
Sets a value which will be used to override any ttl value that may otherwise be set
based on the expiration value when sending the underlying AMQP message.
|
void |
setApplicationProperty(String key,
Object value) |
void |
setContentType(String value) |
void |
setCorrelationId(String correlationId)
Sets the correlation ID for this message.
|
void |
setCorrelationIdBytes(byte[] correlationId)
Sets the correlation ID of the message in raw byte form.
|
void |
setDeliveryCount(int deliveryCount)
Sets the delivery count on the message.
|
void |
setDestination(JmsDestination destination)
Sets the Destination that this message is being sent to.
|
void |
setExpiration(long expiration)
Sets an expiration time on this message.
|
void |
setGroupId(String groupId)
Sets the Group ID to use for this message.
|
void |
setGroupSequence(int groupSequence)
Sets the group sequence value for this message.
|
void |
setMessageId(String messageId)
Sets the message ID for this message.
|
void |
setPersistent(boolean value)
Sets the persistent flag on this message.
|
void |
setPriority(int priority)
Sets the message priority for this message using a JMS priority scoped value.
|
void |
setProperty(String key,
Object value)
Sets the message property value using the supplied key to identify the value
that should be set or updated.
|
void |
setProviderMessageIdObject(Object messageId)
Sets the underlying providers message ID object for this message, or
clears it if the provided value is null.
|
void |
setRedelivered(boolean redelivered)
Used to set the redelivered state of a message.
|
void |
setRedeliveryCount(int redeliveryCount)
Used to update the message redelivery after a local redelivery of the Message
has been performed.
|
void |
setReplyTo(JmsDestination replyTo)
Sets the Destination where replies to this Message are to be sent.
|
void |
setReplyToGroupId(String replyToGroupId) |
void |
setTimestamp(long timestamp)
Sets the timestamp value of this message.
|
void |
setType(String type)
Sets the String value used to define the Message JMSType by the client.
|
void |
setUserId(String userId)
Sets the User ID for the connection that is being used to send this message.
|
void |
setUserIdBytes(byte[] userId)
Sets the user ID of the message in raw byte form.
|
protected final org.apache.qpid.proton.message.Message message
protected final AmqpConnection connection
public AmqpJmsMessageFacade(AmqpConnection connection)
connection
- the AmqpConnection that under which this facade was created.public AmqpJmsMessageFacade(AmqpConsumer consumer, org.apache.qpid.proton.message.Message message)
consumer
- the consumer that received this message.message
- the incoming Message instance that is being wrapped.public byte getJmsMsgType()
public String getContentType()
public void setContentType(String value)
public boolean propertyExists(String key) throws javax.jms.JMSException
propertyExists
in interface JmsMessageFacade
key
- The property name that is being searched for.javax.jms.JMSException
- if an error occurs while accessing the Message properties.public boolean applicationPropertyExists(String key) throws javax.jms.JMSException
javax.jms.JMSException
public Set<String> getPropertyNames()
getPropertyNames
in interface JmsMessageFacade
public Set<String> getApplicationPropertyNames(Set<String> propertyNames)
public Object getProperty(String key) throws javax.jms.JMSException
JmsMessageFacade
getProperty
in interface JmsMessageFacade
key
- the key used to access the given property.javax.jms.JMSException
- if an error occurs while accessing the Message properties.public Object getApplicationProperty(String key) throws javax.jms.JMSException
javax.jms.JMSException
public void setProperty(String key, Object value) throws javax.jms.JMSException
JmsMessageFacade
setProperty
in interface JmsMessageFacade
key
- the key that identifies the message property.value
- the value that is to be stored in the message.javax.jms.JMSException
- if an error occurs while accessing the Message properties.public void setApplicationProperty(String key, Object value) throws javax.jms.JMSException
javax.jms.JMSException
public void onSend(long producerTtl) throws javax.jms.JMSException
JmsMessageFacade
onSend
in interface JmsMessageFacade
producerTtl
- the time to live value configured on the producer when sent.javax.jms.JMSException
- if an error occurs while preparing the message for send.public void onDispatch() throws javax.jms.JMSException
JmsMessageFacade
onDispatch
in interface JmsMessageFacade
javax.jms.JMSException
- if an error occurs while preparing the message for send.public void clearBody()
JmsMessageFacade
clearBody
in interface JmsMessageFacade
public void clearProperties() throws javax.jms.JMSException
JmsMessageFacade
clearProperties
in interface JmsMessageFacade
javax.jms.JMSException
- if an error occurs while accessing the message properties.public AmqpJmsMessageFacade copy() throws javax.jms.JMSException
JmsMessageFacade
copy
in interface JmsMessageFacade
javax.jms.JMSException
- if an error occurs while copying the message.protected void copyInto(AmqpJmsMessageFacade target)
public String getMessageId()
JmsMessageFacade
getMessageId
in interface JmsMessageFacade
public Object getProviderMessageIdObject()
JmsMessageFacade
getProviderMessageIdObject
in interface JmsMessageFacade
public void setProviderMessageIdObject(Object messageId)
JmsMessageFacade
setProviderMessageIdObject
in interface JmsMessageFacade
messageId
- The message ID to set on this message, or null to clear.public void setMessageId(String messageId)
JmsMessageFacade
setMessageId
in interface JmsMessageFacade
messageId
- The message ID to set on this message, or null to clear.public long getTimestamp()
JmsMessageFacade
getTimestamp
in interface JmsMessageFacade
public void setTimestamp(long timestamp)
JmsMessageFacade
setTimestamp
in interface JmsMessageFacade
timestamp
- the time that the message was sent by the provider.public String getCorrelationId()
JmsMessageFacade
getCorrelationId
in interface JmsMessageFacade
public void setCorrelationId(String correlationId) throws IdConversionException
JmsMessageFacade
setCorrelationId
in interface JmsMessageFacade
correlationId
- The correlation ID to set on this message, or null to clear.IdConversionException
public byte[] getCorrelationIdBytes() throws javax.jms.JMSException
JmsMessageFacade
getCorrelationIdBytes
in interface JmsMessageFacade
javax.jms.JMSException
- if an error occurs while accessing the property.public void setCorrelationIdBytes(byte[] correlationId)
JmsMessageFacade
setCorrelationIdBytes
in interface JmsMessageFacade
correlationId
- the byte array to use to set the message correlation ID.public boolean isPersistent()
isPersistent
in interface JmsMessageFacade
public void setPersistent(boolean value)
JmsMessageFacade
setPersistent
in interface JmsMessageFacade
value
- true if the message is to be marked as persistent.public int getDeliveryCount()
JmsMessageFacade
getDeliveryCount
in interface JmsMessageFacade
public void setDeliveryCount(int deliveryCount)
JmsMessageFacade
setDeliveryCount
in interface JmsMessageFacade
deliveryCount
- the new delivery count to assign the Message.public int getRedeliveryCount()
JmsMessageFacade
getRedeliveryCount
in interface JmsMessageFacade
public void setRedeliveryCount(int redeliveryCount)
JmsMessageFacade
setRedeliveryCount
in interface JmsMessageFacade
redeliveryCount
- the new redelivery count to assign the Message.public boolean isRedelivered()
JmsMessageFacade
isRedelivered
in interface JmsMessageFacade
public void setRedelivered(boolean redelivered)
JmsMessageFacade
setRedelivered
in interface JmsMessageFacade
redelivered
- true if the message is to be marked as redelivered, false otherwise.public String getType()
JmsMessageFacade
getType
in interface JmsMessageFacade
public void setType(String type)
JmsMessageFacade
setType
in interface JmsMessageFacade
type
- the JMSType value the client assigns to this message.public int getPriority()
JmsMessageFacade
getPriority
in interface JmsMessageFacade
public void setPriority(int priority)
JmsMessageFacade
setPriority
in interface JmsMessageFacade
priority
- the new priority value to set on this message.public long getExpiration()
JmsMessageFacade
getExpiration
in interface JmsMessageFacade
public void setExpiration(long expiration)
JmsMessageFacade
setExpiration
in interface JmsMessageFacade
expiration
- the time that this message should be considered as expired.public void setAmqpTimeToLiveOverride(Long ttl) throws javax.jms.MessageFormatException
ttl
- the value to use, in range 0 <= x <= 2^32 - 1javax.jms.MessageFormatException
- if the TTL value is not in the allowed range.public boolean hasAmqpTimeToLiveOverride()
public long getAmqpTimeToLiveOverride()
public JmsDestination getDestination()
JmsMessageFacade
getDestination
in interface JmsMessageFacade
public void setDestination(JmsDestination destination)
JmsMessageFacade
setDestination
in interface JmsMessageFacade
destination
- the destination that this message is being sent to.public JmsDestination getReplyTo()
JmsMessageFacade
getReplyTo
in interface JmsMessageFacade
public void setReplyTo(JmsDestination replyTo)
JmsMessageFacade
setReplyTo
in interface JmsMessageFacade
replyTo
- the Destination where replies should be sent, or null to clear.public void setReplyToGroupId(String replyToGroupId)
public String getReplyToGroupId()
public String getUserId()
JmsMessageFacade
getUserId
in interface JmsMessageFacade
public void setUserId(String userId)
JmsMessageFacade
setUserId
in interface JmsMessageFacade
userId
- the user ID that sent this message or null to clear.public byte[] getUserIdBytes()
JmsMessageFacade
getUserIdBytes
in interface JmsMessageFacade
public void setUserIdBytes(byte[] userId)
JmsMessageFacade
setUserIdBytes
in interface JmsMessageFacade
userId
- the byte array to use to set the message user ID.public String getGroupId()
JmsMessageFacade
getGroupId
in interface JmsMessageFacade
public void setGroupId(String groupId)
JmsMessageFacade
setGroupId
in interface JmsMessageFacade
groupId
- the Group ID that this message is assigned to.public int getGroupSequence()
JmsMessageFacade
getGroupSequence
in interface JmsMessageFacade
public void setGroupSequence(int groupSequence)
JmsMessageFacade
setGroupSequence
in interface JmsMessageFacade
groupSequence
- the group sequence value to assign this message.public org.apache.qpid.proton.message.Message getAmqpMessage()
public AmqpConnection getConnection()
Copyright © 2013–2016 The Apache Software Foundation. All rights reserved.