Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1716F10D48 for ; Wed, 2 Apr 2014 16:27:19 +0000 (UTC) Received: (qmail 553 invoked by uid 500); 2 Apr 2014 16:27:17 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 495 invoked by uid 500); 2 Apr 2014 16:27:16 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 475 invoked by uid 99); 2 Apr 2014 16:27:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Apr 2014 16:27:15 +0000 Date: Wed, 2 Apr 2014 16:27:15 +0000 (UTC) From: "Joe Luo (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CAMEL-7338) CxfClientCallback should not populate camel exchange OUT message if no response comes back to cxf producer and camel exchange pattern is InOnly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-7338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Joe Luo updated CAMEL-7338: --------------------------- Patch Info: Patch Available > CxfClientCallback should not populate camel exchange OUT message if no response comes back to cxf producer and camel exchange pattern is InOnly > ----------------------------------------------------------------------------------------------------------------------------------------------- > > Key: CAMEL-7338 > URL: https://issues.apache.org/jira/browse/CAMEL-7338 > Project: Camel > Issue Type: Bug > Components: camel-cxf > Affects Versions: 2.10.4 > Reporter: Joe Luo > Attachments: patch.txt > > > I have a following camel route: > {code} > String destination = "cxf:http://localhost:9090/test?dataFormat=MESSAGE"; > from("jms:queue:dslSource") > .onException(java.net.ConnectException.class, Exception.class) > .maximumRedeliveries(3) > .maximumRedeliveryDelay(3000) > .retryAttemptedLogLevel(LoggingLevel.INFO) > .log(LoggingLevel.WARN, "Failed to send message ${body}") > .log(LoggingLevel.WARN, "Sending message to the error queue: ${body}") // body is null here > .to("jms:queue:dslError") > .end() > .log(LoggingLevel.INFO, "Sending message ...") > .setHeader("bridgeDestination", constant(destination)) > .to(destination) > .log(LoggingLevel.INFO, "received back: ${body}") > .routeId("example-dsl"); > {code} > If an exception is thrown, for instance, a ConnectionException due to unavailability of the backend web service, the onException() route will be executed. The first log endpoint: > {code} > .log(LoggingLevel.WARN, "Failed to send message ${body}") > {code} > prints out camel exchange IN message body without any problem. However, the second log endpoint: > {code} > .log(LoggingLevel.WARN, "Sending message to the error queue: ${body}") > {code} > only prints out the camel exchange IN message body as NULL. > The reason is that when an exception is thrown, the CxfClientCallback.handleException() is called: > {code} > public void handleException(Map ctx, Throwable ex) { > .... > 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); > } > ... > {code} > and this line always populates camel exchange OUT message regardless whether there is a CXF response back or not: > {code} > camelExchange.getOut().getHeaders().putAll(camelExchange.getIn().getHeaders()); > {code} > Therefore, the second log endpoint within onException() block has it's camel exchange IN message been overwritten and replaced with OUT message from previous endpoint's although it is a message of NULL body. -- This message was sent by Atlassian JIRA (v6.2#6252)