You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by dkozic <dr...@asw.eu> on 2008/10/23 13:50:55 UTC

Ending choice().when() block

Hi there,

Can anybody explain to me how to end choice().when() block in Java DSL.

In Spring configuration it clearly demarcated

<from uri="sourceURL"/>
<to uri ="uriA"/>
    <choice>
      <when>
        <simple>header.foo = 'bar'</simple>
        <to uri="Target1"/>
      </when>
      <otherwise>
        <to uri="Target2"/>
      </otherwise>
    </choice>
<to uri="uriB"/>

>From this configuration it is clear that  uriB will be "executed" after
choice. So possible message flow is:
1. sourceURL -> uriA -> Target1 -> uriB
or
2. sourceURL -> uriA -> Target2 -> uriB

How to achieve this in Java DSL? It is not clear where otherwise block ends.
For instance:
from("sourceURL").to("uriA").choice().
         when().simple("header.foo = 'bar'").to("Target1").
         otherwise().to("Target2").to("uriB")

I found end() method in RouteBuilder, but I can not find any documentation
about that.

Thanks in advance
-- 
View this message in context: http://www.nabble.com/Ending-choice%28%29.when%28%29-block-tp20129377p20129377.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.