You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Martin Landua (JIRA)" <ji...@apache.org> on 2006/11/09 22:18:02 UTC

[jira] Created: (SM-744) Request/Response for jms through MessageID/CorrelationID

Request/Response for jms through MessageID/CorrelationID
--------------------------------------------------------

                 Key: SM-744
                 URL: https://issues.apache.org/activemq/browse/SM-744
             Project: ServiceMix
          Issue Type: Improvement
          Components: servicemix-jms
         Environment: All platforms
            Reporter: Martin Landua
            Priority: Minor


The servicemix-jms component assumes that the request/reponse pattern is implemented by the client by using some artificial correlation id as the "connection" between the messages (as described in http://activemq.org/site/how-should-i-implement-request-response-with-jms.html).

However, there are cases where the client assumes that the server sets the correlation id of the response to the message id (!) of the request. Currently, the servicemix-jms component does not support this, but it would be convenient if it were configurable.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (SM-744) Request/Response for jms through MessageID/CorrelationID

Posted by "Grant McDonald (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-744?page=all ]

Grant McDonald resolved SM-744.
-------------------------------

    Fix Version/s: incubation
       Resolution: Fixed
         Assignee: Grant McDonald

Author: grantm
Date: Mon Nov 13 00:06:18 2006
New Revision: 474184

URL: http://svn.apache.org/viewvc?view=rev&rev=474184
Log:
SM-744: added XBean configuration option to jms endpoint to allow for using the JMS request message id as the JMS correlation id. Patch provided by Martin Landua

Modified:
   incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsEndpoint.java
 incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/jca/JcaConsumerProcessor.java
   incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingConsumerProcessor.java
   incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardConsumerProcessor.java


> Request/Response for jms through MessageID/CorrelationID
> --------------------------------------------------------
>
>                 Key: SM-744
>                 URL: https://issues.apache.org/activemq/browse/SM-744
>             Project: ServiceMix
>          Issue Type: Improvement
>          Components: servicemix-jms
>         Environment: All platforms
>            Reporter: Martin Landua
>         Assigned To: Grant McDonald
>            Priority: Minor
>             Fix For: incubation
>
>         Attachments: servicemix-jms-patch
>
>
> The servicemix-jms component assumes that the request/reponse pattern is implemented by the client by using some artificial correlation id as the "connection" between the messages (as described in http://activemq.org/site/how-should-i-implement-request-response-with-jms.html).
> However, there are cases where the client assumes that the server sets the correlation id of the response to the message id (!) of the request. Currently, the servicemix-jms component does not support this, but it would be convenient if it were configurable.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SM-744) Request/Response for jms through MessageID/CorrelationID

Posted by "Martin Landua (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-744?page=all ]

Martin Landua updated SM-744:
-----------------------------

    Attachment: servicemix-jms-patch

> Request/Response for jms through MessageID/CorrelationID
> --------------------------------------------------------
>
>                 Key: SM-744
>                 URL: https://issues.apache.org/activemq/browse/SM-744
>             Project: ServiceMix
>          Issue Type: Improvement
>          Components: servicemix-jms
>         Environment: All platforms
>            Reporter: Martin Landua
>            Priority: Minor
>         Attachments: servicemix-jms-patch
>
>
> The servicemix-jms component assumes that the request/reponse pattern is implemented by the client by using some artificial correlation id as the "connection" between the messages (as described in http://activemq.org/site/how-should-i-implement-request-response-with-jms.html).
> However, there are cases where the client assumes that the server sets the correlation id of the response to the message id (!) of the request. Currently, the servicemix-jms component does not support this, but it would be convenient if it were configurable.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SM-744) Request/Response for jms through MessageID/CorrelationID

Posted by "Grant McDonald (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-744?page=comments#action_37417 ] 
            
Grant McDonald commented on SM-744:
-----------------------------------

Martin,

Could you please expand upon the circumstances/scenarios where this occurs?  The only places I found the JMS correlation id being set to the exchange id was in MultiplexingProviderProcessor(161) and StandardProviderProcessor(101) which you would expect from messages coming from the NMR onto JMS and having an InOut MEP.  Under what scenario is there an expectation in the client that the JMS correlation id will be a message exchange id?


> Request/Response for jms through MessageID/CorrelationID
> --------------------------------------------------------
>
>                 Key: SM-744
>                 URL: https://issues.apache.org/activemq/browse/SM-744
>             Project: ServiceMix
>          Issue Type: Improvement
>          Components: servicemix-jms
>         Environment: All platforms
>            Reporter: Martin Landua
>            Priority: Minor
>
> The servicemix-jms component assumes that the request/reponse pattern is implemented by the client by using some artificial correlation id as the "connection" between the messages (as described in http://activemq.org/site/how-should-i-implement-request-response-with-jms.html).
> However, there are cases where the client assumes that the server sets the correlation id of the response to the message id (!) of the request. Currently, the servicemix-jms component does not support this, but it would be convenient if it were configurable.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SM-744) Request/Response for jms through MessageID/CorrelationID

Posted by "Martin Landua (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-744?page=comments#action_37428 ] 
            
Martin Landua commented on SM-744:
----------------------------------

You are right, this would be a static configuration, but the client in fact would not expect the server's behavior to change at runtime.

I attached a patch for this issue.

Regards
Martin

> Request/Response for jms through MessageID/CorrelationID
> --------------------------------------------------------
>
>                 Key: SM-744
>                 URL: https://issues.apache.org/activemq/browse/SM-744
>             Project: ServiceMix
>          Issue Type: Improvement
>          Components: servicemix-jms
>         Environment: All platforms
>            Reporter: Martin Landua
>            Priority: Minor
>         Attachments: servicemix-jms-patch
>
>
> The servicemix-jms component assumes that the request/reponse pattern is implemented by the client by using some artificial correlation id as the "connection" between the messages (as described in http://activemq.org/site/how-should-i-implement-request-response-with-jms.html).
> However, there are cases where the client assumes that the server sets the correlation id of the response to the message id (!) of the request. Currently, the servicemix-jms component does not support this, but it would be convenient if it were configurable.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SM-744) Request/Response for jms through MessageID/CorrelationID

Posted by "Martin Landua (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-744?page=comments#action_37421 ] 
            
Martin Landua commented on SM-744:
----------------------------------

Grant,

please find enclosed the diff, which might illustrate how I would think it could work:

Index: ./ServiceMix-SNAPSHOT/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardConsumerProcessor.java
===================================================================
--- ./ServiceMix-SNAPSHOT/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardConsumerProcessor.java	(revision 472981)
+++ ./ServiceMix-SNAPSHOT/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/standard/StandardConsumerProcessor.java	(working copy)
@@ -123,7 +123,11 @@
                 response = fromNMSResponse(exchange, context, session);
                 if (response != null) {
                     producer = session.createProducer(message.getJMSReplyTo());
-                    response.setJMSCorrelationID(message.getJMSCorrelationID());
+                    if (endpoint.isUseMsgIdInResponse()) {
+                        response.setJMSCorrelationID(message.getJMSMessageID());
+                    } else {
+                        response.setJMSCorrelationID(message.getJMSCorrelationID());
+                    }
                     producer.send(response);
                 }
             } finally {
Index: ./ServiceMix-SNAPSHOT/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingConsumerProcessor.java
===================================================================
--- ./ServiceMix-SNAPSHOT/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingConsumerProcessor.java	(revision 472981)
+++ ./ServiceMix-SNAPSHOT/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingConsumerProcessor.java	(working copy)
@@ -109,7 +109,11 @@
             response = fromNMSResponse(exchange, context, session);
             if (response != null) {
                 producer = session.createProducer(message.getJMSReplyTo());
-                response.setJMSCorrelationID(message.getJMSCorrelationID());
+                if (endpoint.isUseMsgIdInResponse()) {
+                    response.setJMSCorrelationID(message.getJMSMessageID());
+                } else {
+                    response.setJMSCorrelationID(message.getJMSCorrelationID());
+                }
                 producer.send(response);
             }
         } finally {
Index: ./ServiceMix-SNAPSHOT/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsEndpoint.java
===================================================================
--- ./ServiceMix-SNAPSHOT/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsEndpoint.java	(revision 472981)
+++ ./ServiceMix-SNAPSHOT/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsEndpoint.java	(working copy)
@@ -56,6 +56,8 @@
     protected String jndiConnectionFactoryName;
     protected String jndiDestinationName;
     protected String jmsProviderDestinationName;
+    
+    protected boolean useMsgIdInResponse;
     //
     // Spring configuration
     //
@@ -458,4 +460,17 @@
         return component.getKeystoreManager();
     }
 
+    /**
+     * Determines whether for a request/response pattern, the message id of the request message
+     * should be used as the correlation id in the response or the correlation id of the request.
+     * @return
+     */
+    public boolean isUseMsgIdInResponse() {
+        return useMsgIdInResponse;
+    }
+
+    public void setUseMsgIdInResponse(boolean useMsgIdInResponse) {
+        this.useMsgIdInResponse = useMsgIdInResponse;
+    }
+
 }
\ No newline at end of file
Index: ./ServiceMix-SNAPSHOT/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/jca/JcaConsumerProcessor.java
===================================================================
--- ./ServiceMix-SNAPSHOT/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/jca/JcaConsumerProcessor.java	(revision 472981)
+++ ./ServiceMix-SNAPSHOT/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/jca/JcaConsumerProcessor.java	(working copy)
@@ -138,7 +138,11 @@
             response = fromNMSResponse(exchange, context, session);
             if (response != null) {
                 MessageProducer producer = session.createProducer(message.getJMSReplyTo());
-                response.setJMSCorrelationID(message.getJMSCorrelationID());
+                if (endpoint.isUseMsgIdInResponse()) {
+                    response.setJMSCorrelationID(message.getJMSMessageID());
+                } else {
+                    response.setJMSCorrelationID(message.getJMSCorrelationID());
+                }
                 producer.send(response);
             }
         } finally {


> Request/Response for jms through MessageID/CorrelationID
> --------------------------------------------------------
>
>                 Key: SM-744
>                 URL: https://issues.apache.org/activemq/browse/SM-744
>             Project: ServiceMix
>          Issue Type: Improvement
>          Components: servicemix-jms
>         Environment: All platforms
>            Reporter: Martin Landua
>            Priority: Minor
>
> The servicemix-jms component assumes that the request/reponse pattern is implemented by the client by using some artificial correlation id as the "connection" between the messages (as described in http://activemq.org/site/how-should-i-implement-request-response-with-jms.html).
> However, there are cases where the client assumes that the server sets the correlation id of the response to the message id (!) of the request. Currently, the servicemix-jms component does not support this, but it would be convenient if it were configurable.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SM-744) Request/Response for jms through MessageID/CorrelationID

Posted by "Grant McDonald (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-744?page=comments#action_37422 ] 
            
Grant McDonald commented on SM-744:
-----------------------------------

That clarifies things quite a bit.  I can see that in certain circumstances that this would be useful.  The only thing to keep in mind is that such configuration is static for the lifetime of the endpoint - but I guess your client isn't going to be expecting it to be any different.  I would like to hear what Guillaume has to say about such configuration options and whether it's appropriate or not.  Can you please attach a patch of your changes?

> Request/Response for jms through MessageID/CorrelationID
> --------------------------------------------------------
>
>                 Key: SM-744
>                 URL: https://issues.apache.org/activemq/browse/SM-744
>             Project: ServiceMix
>          Issue Type: Improvement
>          Components: servicemix-jms
>         Environment: All platforms
>            Reporter: Martin Landua
>            Priority: Minor
>
> The servicemix-jms component assumes that the request/reponse pattern is implemented by the client by using some artificial correlation id as the "connection" between the messages (as described in http://activemq.org/site/how-should-i-implement-request-response-with-jms.html).
> However, there are cases where the client assumes that the server sets the correlation id of the response to the message id (!) of the request. Currently, the servicemix-jms component does not support this, but it would be convenient if it were configurable.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SM-744) Request/Response for jms through MessageID/CorrelationID

Posted by "Martin Landua (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-744?page=comments#action_37420 ] 
            
Martin Landua commented on SM-744:
----------------------------------

Grant,

consider an external client, which sends a request to a servicemix application through jms and expects an answer to some reply queue, which the client provides. Please note that I am talking about an external client, not another servicemix application.

Now, one option for the client is to provide a correlation id that it expects to be returned with the response. That is one pattern, which also servicemix uses as you correctly pointed out in MultiplexingProviderProcessor(161) and StandardProviderProcessor(101). Everything is fine for this scenario.

Another pattern could be that the client does not create an arbitrary correlation id but instead it expects servicemix to return the message id of the jms request message (not any exchange id) to be returned as the correlation id in the response jms message. Actually we do have a client which relies on this behavior. Currently, servicemix does not support that and I was thinking to add this as a configurable feature.

Hope this clarifies my question.

Best regards
Martin

> Request/Response for jms through MessageID/CorrelationID
> --------------------------------------------------------
>
>                 Key: SM-744
>                 URL: https://issues.apache.org/activemq/browse/SM-744
>             Project: ServiceMix
>          Issue Type: Improvement
>          Components: servicemix-jms
>         Environment: All platforms
>            Reporter: Martin Landua
>            Priority: Minor
>
> The servicemix-jms component assumes that the request/reponse pattern is implemented by the client by using some artificial correlation id as the "connection" between the messages (as described in http://activemq.org/site/how-should-i-implement-request-response-with-jms.html).
> However, there are cases where the client assumes that the server sets the correlation id of the response to the message id (!) of the request. Currently, the servicemix-jms component does not support this, but it would be convenient if it were configurable.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SM-744) Request/Response for jms through MessageID/CorrelationID

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-744?page=comments#action_37427 ] 
            
Guillaume Nodet commented on SM-744:
------------------------------------

I do not see any reason to not include the patch if it solves an actual use case.

> Request/Response for jms through MessageID/CorrelationID
> --------------------------------------------------------
>
>                 Key: SM-744
>                 URL: https://issues.apache.org/activemq/browse/SM-744
>             Project: ServiceMix
>          Issue Type: Improvement
>          Components: servicemix-jms
>         Environment: All platforms
>            Reporter: Martin Landua
>            Priority: Minor
>
> The servicemix-jms component assumes that the request/reponse pattern is implemented by the client by using some artificial correlation id as the "connection" between the messages (as described in http://activemq.org/site/how-should-i-implement-request-response-with-jms.html).
> However, there are cases where the client assumes that the server sets the correlation id of the response to the message id (!) of the request. Currently, the servicemix-jms component does not support this, but it would be convenient if it were configurable.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira