camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gert Vanthienen <gert.vanthie...@skynet.be>
Subject Re: When().choice() & Filter() DSL not supported together !!
Date Wed, 09 Jul 2008 07:35:11 GMT
Charles,

The end() method returns the raw ProcessorType.  You need a ChoiceType 
in order to be able to access the otherwise() method.
One option would be to assign the result of from("")....end() to a local 
variable of type ChoiceType -- adding the necessary cast.  Afterwards, 
you can add the otherwise().  Somthing like:
  ChoiceType choice = (ChoiceType) 
from("").choice().when()....to("queue:A").end();
  choice.otherwise.to("queue:A")

Another option would be to extract the routing logic for the first 
when() clause in a separate route (starting with e.g. a direct: style 
endpoint) and just code 
when().xpath().to("direct:when1").otherwise().to("queue:B").

We are currently adding a Scala DSL, which will allow you to use {} to 
explicitly define the blocks in your routes (have a look at 
http://activemq.apache.org/camel/scala-dsl-eip.html for some examples).

Regards,

Gert

cmoulliard wrote:
> Hi,
>
> I would lie to know why the following route cannot be configurated and if
> there is a workaround ?
>
> from("")
> .choice()
> .when.xpath("")
>         .setHeader("name").xpath("")
>         .filter().xquery("extract a part of the XML")
>             .unmarshall()
>         .to("queue:A")
>         .end()
> .otherwise().to("queue:B"); 
>
> Regards,
>
> charles
>   


Mime
View raw message