diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2007-11-07 12:36:36 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2007-11-07 12:36:36 +0000 |
| commit | 793a6b31f7ad6b27f0683eef52ae92e05d7f8fee (patch) | |
| tree | 0bbd157b996c54e27bfbaadf6de6f0153909d630 /java/client/src/main | |
| parent | c346e8d12bd8a287695f9a427e22e9c837b866cb (diff) | |
| download | qpid-python-793a6b31f7ad6b27f0683eef52ae92e05d7f8fee.tar.gz | |
QPID-160 Addition of JMSXUserID to all messages through the java broker.
As this will cause the headers to be re-encoded it can be disabled in the config.xml. Default is enabled as the sample config.xml should have all features enabled so that testing can observe the interactions.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1@592729 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src/main')
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java | 9 | ||||
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java | 26 |
2 files changed, 25 insertions, 10 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java b/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java index a5e89ef4fc..07d5d5dd32 100644 --- a/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java +++ b/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java @@ -29,9 +29,10 @@ import org.apache.qpid.framing.AMQShortString; public enum CustomJMSXProperty
{
JMS_AMQP_NULL,
- JMS_QPID_DESTTYPE,
+ JMS_QPID_DESTTYPE,
JMSXGroupID,
- JMSXGroupSeq;
+ JMSXGroupSeq,
+ JMSXUserID;
private final AMQShortString _nameAsShortString;
@@ -47,7 +48,7 @@ public enum CustomJMSXProperty }
private static Enumeration _names;
-
+
public static synchronized Enumeration asEnumeration()
{
if(_names == null)
@@ -60,6 +61,6 @@ public enum CustomJMSXProperty }
_names = Collections.enumeration(nameList);
}
- return _names;
+ return _names;
}
}
diff --git a/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java b/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java index 2dfeb19268..b029770946 100644 --- a/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java +++ b/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java @@ -73,11 +73,11 @@ public abstract class AbstractJMSMessage extends AMQMessage implements org.apach _headerAdapter = new JMSHeaderAdapter(((BasicContentHeaderProperties) _contentHeaderProperties).getHeaders()); _strictAMQP = - Boolean.parseBoolean(System.getProperties().getProperty(AMQSession.STRICT_AMQP, AMQSession.STRICT_AMQP_DEFAULT)); + Boolean.parseBoolean(System.getProperties().getProperty(AMQSession.STRICT_AMQP, AMQSession.STRICT_AMQP_DEFAULT)); } protected AbstractJMSMessage(long deliveryTag, BasicContentHeaderProperties contentHeader, AMQShortString exchange, - AMQShortString routingKey, ByteBuffer data) throws AMQException + AMQShortString routingKey, ByteBuffer data) throws AMQException { this(contentHeader, deliveryTag); @@ -201,7 +201,7 @@ public abstract class AbstractJMSMessage extends AMQMessage implements org.apach if (!(destination instanceof AMQDestination)) { throw new IllegalArgumentException( - "ReplyTo destination may only be an AMQDestination - passed argument was type " + destination.getClass()); + "ReplyTo destination may only be an AMQDestination - passed argument was type " + destination.getClass()); } final AMQDestination amqd = (AMQDestination) destination; @@ -391,12 +391,26 @@ public abstract class AbstractJMSMessage extends AMQMessage implements org.apach public String getStringProperty(String propertyName) throws JMSException { - if (_strictAMQP) + + if (propertyName.startsWith("JMSX")) { - throw new UnsupportedOperationException("JMS Proprerties not supported in AMQP"); + //NOTE: if the JMSX Property is a non AMQP property then we must check _strictAMQP and throw as below. + if (propertyName.equals(CustomJMSXProperty.JMSXUserID.toString())) + { + return ((BasicContentHeaderProperties) _contentHeaderProperties).getUserIdAsString(); + } + + return null; } + else + { + if (_strictAMQP) + { + throw new UnsupportedOperationException("JMS Proprerties not supported in AMQP"); + } - return getJmsHeaders().getString(propertyName); + return getJmsHeaders().getString(propertyName); + } } public Object getObjectProperty(String propertyName) throws JMSException |
