You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org> on 2012/01/27 14:34:04 UTC

[jira] [Commented] (CAMEL-4945) CXF Producer calls done method of Camel callback several times

    [ https://issues.apache.org/jira/browse/CAMEL-4945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13194702#comment-13194702 ] 

Claus Ibsen commented on CAMEL-4945:
------------------------------------

Thanks for reporting.

Is it possible for you to either create a
- patch with a proposed fix
- unit test demonstrating the issue

ASF requires that any contributed code is attached as files to a JIRA ticket and where you click [x] in grant license to Apache.
If not then we cannot accept your contribution.
                
> CXF Producer calls done method of Camel callback several times
> --------------------------------------------------------------
>
>                 Key: CAMEL-4945
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4945
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.8.3, 2.9.0
>            Reporter: Stefan Boller
>
> If the CXF Producer of Camel is called asynchronously for a WS-RM endpoint, Camel receives multiple final events, like ExchangeCompletedEvent and ExchangeFailedEvent. This leads also to negative JMX counters for inflight exchanges. The root cause is a bug in the handleResponse and handleException methods of org.apache.camel.component.cxf.CxfClientCallback. In those methods, which are called for WS-RM communication, although it is oneway, the done method of camelAsyncCallback is called also for oneway exchanges. However this callback method is already called in the process method of org.apache.camel.component.cxf.CxfProducer for oneway exchanges, which causes the mentioned effects.
> The following changes in org.apache.camel.component.cxf.CxfClientCallback can fix this:
>     public void handleResponse(Map<String, Object> ctx, Object[] res) {
>         try {
>             super.handleResponse(ctx, res);            
>         } finally {
>             // bind the CXF response to Camel exchange
>             if (!boi.getOperationInfo().isOneWay()) {
>                 // copy the InMessage header to OutMessage header
>                 camelExchange.getOut().getHeaders().putAll(camelExchange.getIn().getHeaders());
>                 binding.populateExchangeFromCxfResponse(camelExchange, cxfExchange, ctx);
> 				camelAsyncCallback.done(false);
>             }
>             if (LOG.isDebugEnabled()) {
>                 LOG.debug("{} calling handleResponse", Thread.currentThread().getName());
>             }
>         }
>     }
>     
>     public void handleException(Map<String, Object> ctx, Throwable ex) {
>         try {
>             super.handleException(ctx, ex);
>             camelExchange.setException(ex);
>         } finally {
>             // copy the context information
>             if (!boi.getOperationInfo().isOneWay()) {
>                 // copy the InMessage header to OutMessage header
>                 camelExchange.getOut().getHeaders().putAll(camelExchange.getIn().getHeaders());
>                 binding.populateExchangeFromCxfResponse(camelExchange, cxfExchange, ctx);
> 				camelAsyncCallback.done(false);
>             }
>             if (LOG.isDebugEnabled()) {
>                 LOG.debug("{} calling handleException", Thread.currentThread().getName());
>             }
>         }
>     }        

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira