camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From camel <>
Subject Apache Camel overriding Exchange.OutOnly behaviour to return body
Date Thu, 11 Sep 2014 09:58:40 GMT

I had an issue with Apache Camel that timeouts for after 20 seconds.

I was getting timeout errors after 20 seconds. I have a custom processor the
implements Processor. I injected a DAO and when finding the data within the
custom processor it took longer to find the data on the Apache Camel side
and it timed out. If I run the same code without Apache Camel it runs
instantly. By doing a SELECT inside the CustomProcessor it took longer to
find the data. 

The memory reference for the DAO are the same, so in the test the data is
fetched immediately and the CustomProcessor hangs for 20 seconds before the
data is receieved and it throws an Exception. 

I figured out that I need to add ?disableReplyTo=true as below:

This fixed the timeout issue, but nothing was being added to the queue. When
I request the body of the message it returns the input XML that was sent. By
default, by adding ?disableReplyTo=true sets the ExchangePattern to InOnly.
Is there any way of overriding this to ExchangePattern.OutOnly? I want the
message to be sent to the queue and also I want to get the body of the
message that is set through producerTemplate.requestBody().

What I noted that going from one processor to another the other processor
can access the exchange.setOut() as as exchange.getIn().

I have located the code on Githib:

I tried something like this:
public class ContentEnricherProcessor implements Processor {

private StatusDAO statusDAO;
private Logger logger;

public ContentEnricherProcessor(StatusDAO statusDAO) {
    this.statusDAO = statusDAO;
    logger = LoggerFactory.getLogger(ContentEnricherProcessor.class);

public void process(Exchange exchange) throws Exception {
    exchange.setPattern(ExchangePattern.OutOnly); // by doing
producerTemplate.requestBody() this does not work
    Message message = exchange.getIn();
    Entity entity = (Entity) message.getBody();
    Status status = process(entity);

I hope you can help. 

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message