You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2016/12/13 17:10:14 UTC
[2/2] qpid-jms git commit: QPIDJMS-207: have deliveryTime handling
cope with situations where the JMS 1.1 API is also on classpath and taking
order precedence
QPIDJMS-207: have deliveryTime handling cope with situations where the JMS 1.1 API is also on classpath and taking order precedence
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/56d1622a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/56d1622a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/56d1622a
Branch: refs/heads/master
Commit: 56d1622a65618cec8cd9bebd86e23ae50c5f6955
Parents: 720c650
Author: Robert Gemmell <ro...@apache.org>
Authored: Tue Dec 13 17:09:30 2016 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Tue Dec 13 17:09:30 2016 +0000
----------------------------------------------------------------------
.../java/org/apache/qpid/jms/JmsSession.java | 28 ++++++++++++--------
.../jms/message/JmsMessageTransformation.java | 2 +-
.../qpid-jms-activemq-tests/pom.xml | 11 +++++++-
3 files changed, 28 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/56d1622a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java
index 604d92f..deca6b5 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java
@@ -770,17 +770,6 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe
original.setJMSExpiration(0);
}
- long deliveryTime = 0;
- if (hasDelay) {
- deliveryTime = timeStamp + deliveryDelay;
- }
-
- if(isJmsMessage) {
- original.setJMSDeliveryTime(deliveryTime);
- } else {
- setForeignMessageDeliveryTime(original, deliveryTime);
- }
-
long messageSequence = producer.getNextMessageSequence();
Object messageId = null;
if (!disableMsgId) {
@@ -796,6 +785,23 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe
outbound.setJMSDestination(destination);
}
+ // Set the delivery time. Purposefully avoided doing this earlier so
+ // that we use the 'outbound' JmsMessage object reference when
+ // updating our own message instances, avoids using the interface
+ // in case the JMS 1.1 Message API is actually being used due to
+ // being on the classpath too.
+ long deliveryTime = 0;
+ if (hasDelay) {
+ deliveryTime = timeStamp + deliveryDelay;
+ }
+
+ outbound.setJMSDeliveryTime(deliveryTime);
+ if(!isJmsMessage) {
+ // If the original was a foreign message, we still need to update it too.
+ setForeignMessageDeliveryTime(original, deliveryTime);
+ }
+
+ // Set the message ID
outbound.getFacade().setProviderMessageIdObject(messageId);
if (!isJmsMessage) {
// If the original was a foreign message, we still need to update it
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/56d1622a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageTransformation.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageTransformation.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageTransformation.java
index 4f94db7..405f9ef 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageTransformation.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageTransformation.java
@@ -190,7 +190,7 @@ public final class JmsMessageTransformation {
*
* @throws JMSException if an error occurs during the copy of message properties.
*/
- public static void copyProperties(JmsConnection connection, Message source, Message target) throws JMSException {
+ public static void copyProperties(JmsConnection connection, Message source, JmsMessage target) throws JMSException {
target.setJMSMessageID(source.getJMSMessageID());
target.setJMSCorrelationID(source.getJMSCorrelationID());
target.setJMSReplyTo(transformDestination(connection, source.getJMSReplyTo()));
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/56d1622a/qpid-jms-interop-tests/qpid-jms-activemq-tests/pom.xml
----------------------------------------------------------------------
diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/pom.xml b/qpid-jms-interop-tests/qpid-jms-activemq-tests/pom.xml
index 0a72ad4..516651e 100644
--- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/pom.xml
+++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/pom.xml
@@ -33,8 +33,17 @@
<dependencies>
<!-- =================================== -->
- <!-- Required Dependencies -->
+ <!-- Required Dependencies -->
<!-- =================================== -->
+
+ <!-- Adding the JMS 1.1 API jar for these tests explicitly, first,
+ since its whats implemented by ActiveMQ, and also helps to
+ verify the client works when both APIs are on the classpath -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1.1</version>
+ </dependency>
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-jms-client</artifactId>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org