camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/3] camel git commit: CAMEL-10726 Correlation of JMS InOut exchanges ...
Date Thu, 19 Jan 2017 19:18:30 GMT
Repository: camel
Updated Branches:
  refs/heads/master 4b61cacaf -> a4f82a2c9


CAMEL-10726 Correlation of JMS InOut exchanges ...

...with custom JMS property

This commit adds a setter on the component for setting the new
configuration option `correlationProperty` used for custom property
message correlation.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/cb8da77a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cb8da77a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cb8da77a

Branch: refs/heads/master
Commit: cb8da77aed745f267b33ff46944b109a480ca953
Parents: 8c4a1cc
Author: Zoran Regvart <zoran@regvart.com>
Authored: Thu Jan 19 18:00:53 2017 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Jan 19 19:24:30 2017 +0100

----------------------------------------------------------------------
 .../apache/camel/component/jms/JmsComponent.java   | 17 +++++++++++++++++
 ...RequestReplyCorrelatedWithCustomHeaderTest.java |  5 +++--
 2 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/cb8da77a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
index 67c15e0..3b0b487 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
@@ -1110,6 +1110,23 @@ public class JmsComponent extends HeaderFilterStrategyComponent implements
Appli
         getConfiguration().setWaitForProvisionCorrelationToBeUpdatedThreadSleepingTime(sleepingTime);
     }
 
+    /**
+     * Use this JMS property to correlate messages in InOut exchange pattern (request-reply)
+     * instead of JMSCorrelationID property. This allows you to exchange messages with 
+     * systems that do not correlate messages using JMSCorrelationID JMS property. If used
+     * JMSCorrelationID will not be used or set by Camel. The value of here named property
+     * will be generated if not supplied in the header of the message under the same name.
+     */
+    @Metadata(label = "producer,advanced",
+            description = "Use this JMS property to correlate messages in InOut exchange
pattern (request-reply)"
+                    + " instead of JMSCorrelationID property. This allows you to exchange
messages with"
+                    + " systems that do not correlate messages using JMSCorrelationID JMS
property. If used"
+                    + " JMSCorrelationID will not be used or set by Camel. The value of here
named property"
+                    + " will be generated if not supplied in the header of the message under
the same name.")
+    public void setCorrelationProperty(final String correlationProperty) {
+        getConfiguration().setCorrelationProperty(correlationProperty);
+    }
+
     // Implementation methods
     // -------------------------------------------------------------------------
 

http://git-wip-us.apache.org/repos/asf/camel/blob/cb8da77a/components/camel-jms/src/test/java/org/apache/camel/component/jms/RequestReplyCorrelatedWithCustomHeaderTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/RequestReplyCorrelatedWithCustomHeaderTest.java
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/RequestReplyCorrelatedWithCustomHeaderTest.java
index d09a202..87001be 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/RequestReplyCorrelatedWithCustomHeaderTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/RequestReplyCorrelatedWithCustomHeaderTest.java
@@ -42,7 +42,7 @@ public class RequestReplyCorrelatedWithCustomHeaderTest extends CamelTestSupport
 
     @Test
     public void shouldCorrelateRepliesWithCustomCorrelationProperty() throws Exception {
-        final String reply = template.requestBody("activemq:queue:request?correlationProperty=CustomCorrelation",
+        final String reply = template.requestBody("activemq:queue:request",
                 "Bobby", String.class);
 
         assertTrue(reply.matches("Hi, Bobby, Camel-.*"));
@@ -51,7 +51,7 @@ public class RequestReplyCorrelatedWithCustomHeaderTest extends CamelTestSupport
     @Test
     public void shouldCorrelateRepliesWithCustomCorrelationPropertyAndValue() throws Exception
{
         final String reply = template.requestBodyAndHeader(
-                "activemq:queue:request?correlationProperty=CustomCorrelation", "Bobby",
"CustomCorrelation",
+                "activemq:queue:request", "Bobby", "CustomCorrelation",
                 "custom-id", String.class);
 
         assertEquals("Hi, Bobby, custom-id", reply);
@@ -64,6 +64,7 @@ public class RequestReplyCorrelatedWithCustomHeaderTest extends CamelTestSupport
         connectionFactory = CamelJmsTestHelper.createConnectionFactory();
 
         final JmsComponent activeMq = jmsComponentAutoAcknowledge(connectionFactory);
+        activeMq.getConfiguration().setCorrelationProperty("CustomCorrelation");
 
         camelContext.addComponent("activemq", activeMq);
 


Mime
View raw message