camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S.R." <srassok...@gmail.com>
Subject Pipeline and disableReplyTo propositions
Date Fri, 11 Jul 2008 21:44:00 GMT

Hi!

My suggestions/propositions are based on my expirience with Camel that I
received in last several weeks.

1. Pipeline original.setOut behaviour.

After all the sub-processors are done, Pipeline processor makes the call:
ExchangeHelper.copyResults(original, nextExchange), that copies
nextExchange.out to the original.out, but... if the nextExchange.out is
null, then it takes nextExchange.in instead:

 Message out = source.getOut(false);
 if (out != null) {
                result.getOut(true).copyFrom(out);
 } else {
                // no results so lets copy the last input
                // as the final processor on a pipeline might not
                // have created any OUT; such as a mock:endpoint
                // so lets assume the last IN is the OUT
                result.getOut(true).copyFrom(source.getIn());
 }

Well, that's reasonable since we will have response in any case. But there
are many situations where it confuses (for example,
http://www.nabble.com/Strange-behaviour-of-bean-processor-to18315409s22882.html).
In the real life I have a little bit different situation, in other words, in
some cases I need to just ignore the fact that JMSReplyTo field is set, and
to not make any replies. disableReplyTo can't be used in my case because it
applies for all messages coming from source destination.

My suggestion on this is to make this bahaviour configurable through the
CamelContext, so that user could choose what type of pipeline behaviour
should be. So the code can look like:

 Message out = source.getOut(false);
 if (out != null) {
                result.getOut(true).copyFrom(out);
 } else if (result.getContext().isUseInAsOutForPipilene()) {
                result.getOut(true).copyFrom(source.getIn());
 }

2. Propagate disableReplyTo property to the JmsProducer

Currently, disableReplyTo property is only applicable for "from" endpoints
meaning that all messages coming to such an endpoint won't have replies. (or
I'm wrong?)

I think, it would be very nice if this property were propagated to the
JmsProducer too, so that it could be used in JmsProducer.process(...) method
like:

 public void process(final Exchange exchange) {
        final org.apache.camel.Message in = exchange.getIn();
        if (exchange.getPattern().isOutCapable() && !this.disableReplyTo) {
                // InOut implementation
        } else {
                // InOnly implementation
        }
 }

So, we would be able to use disableReplyTo parameter for "to" endpoints as
well as for "from" endpoints, for example:

for("jms:testQueue").choice()
    .when(<expr1>).to("jms:oneQueue")
    .when(<expr2>).to("jms:oneQueue?disableReplyTo=true")

if expr2 is true, then the message won't be responded, otherwise it will be.

I have a very brief familiarity with Camel source code, and I can be wrong
in my assumptions, sorry about that:)

That is it for this time:)

Looking forward for your answers.

Thank you,

Sergey
-- 
View this message in context: http://www.nabble.com/Pipeline-and-disableReplyTo-propositions-tp18413084s22882p18413084.html
Sent from the Camel - Development mailing list archive at Nabble.com.


Mime
View raw message