On Fri, Nov 22, 2013 at 1:08 PM, ChrisS <cr019...@gmail.com> wrote:
> Many thanks for your quick response! The advice on using substring of body in
> correlationExpression solves my problem.
>
> Indeed I believe all I need is already in Camel so I don't have to do any
> coding except changing AggregationStrategy to my  to enable my scenario.
>
>
> Other questions I have are related to timeouts. As far as I can understand
> completionTimeout is counted starting on the last Exchange from the same
> correlationExpression.
>
> So in my example from the first post for ID=1,  the first timeout would be
> counted since receiving ID=1, Result=11. Could I specify timeout starting on
> the first Exchange for the given correlationExpression?
>
> I was thinking about using completionInterval for this purpose. Bur from
> what I can read it's basically a thread closing periodically all the open
> Exchanges. So if I set it to 10 sec, some of the exchanges would be closed
> after 10 sec, some at 5 sec and some after 0.1 sec... So it would just
> guarantees that there would be no exchange lasting longer than 10 sec.
>
> So the question here is if there a way to specify timeout for 10 seconds
> counting from the first Exchange for a given correlationExpression?
>
>
> I also assume that setting ignoreInvalidCorrelationKeys="true" in my sense
> makes no sense as the expression is always evaluated so for null input it
> generates:
>
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
> invoke method: .toString().substring(0, 3) on null due to:...
>
> I don't expect null strings. I just hope this exception won't cause any
> side-effects except leaving trace in the logs.
>

For null bodies you can use the null safe ?. operator in simple and do

<simple>${body?.toString().substring(0, 3)}</simple>

If the body is null then the returned value is null.


See details at
http://camel.apache.org/simple


> Many thanks for your help,
>
> Regards,
>
> CS
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/A-simple-Aggregator-use-case-tp5743633p5743688.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to