camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: CAMEL Spring Equivalent of body().isInstanceOf(AddEndpointNotificationMessage.class)
Date Sat, 24 Apr 2010 07:41:28 GMT
Hi,

I don't think current Spring DSL support this, but you can delegate the 
predict to a bean[1] method just like this

<bean name="myBean" class=YOUCLASS/>

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
         <route>
             <from uri="direct:start"/>
             <choice>
                 <when>
                     <method bean="myBean" method="isInstanceOfXXX"/>
                     <processor ref="foo"/>
                 </when>
                 <when>
                     <method bean="myBean" method="isInstanceOfXXX"/>
                     <processor ref="bar"/>
                 </when>
                 ...
             <choice>
        </route>
</camelContext>

[1]http://camel.apache.org/bean.html

Willem

Gareth Collins wrote:
> Hello,
> 
> I had originally written my CAMEL application using Java DSL. Now I want to
> convert to the Spring DSL. I am sure this conversion is obvious (I am new to
> Spring), but I haven't found in the documentation or on the web how to
> convert body().isInstanceOf(xxx.class) i.e.:
> 
> .choice()
>     .when(body().isInstanceOf(xxx.class))
> 	 .process(...).stop()
>     .when(body().isInstanceOf(yyy.class))
>          .process(...).stop()
>     .when(body().isInstanceOf(zzz.class))
>          .process(...)
> .end()
> 
> If someone could help me out and tell me how to do this, or point me to the
> section in the docs which show how to do this in Spring, it would be a
> really big help.
> 
> Thanks very much in advance.
> 
> regards,
> Gareth Collins


Mime
View raw message