You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Joe Luo (JIRA)" <ji...@apache.org> on 2014/04/02 18:15:25 UTC
[jira] [Created] (CAMEL-7338) CxfClientCallback should not populate
camel exchange OUT message if no response comes back to cxf producer and
camel exchange pattern is InOnly
Joe Luo created CAMEL-7338:
------------------------------
Summary: 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
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<String, Object> 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}
--
This message was sent by Atlassian JIRA
(v6.2#6252)