You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Andy Bourke <an...@pcmsgroup.com> on 2010/12/07 13:04:33 UTC

Conditional processing in Spring DSL

Hi,

I have been trying to influence whether or not the next endpoint gets
processed based on some aspect of the mesage body using spring DSL and am
having no luck with it. I have tried various incarnations of the following
configuration (including &lt;CHOICE&gt;&lt;WHEN&gt; tags in place of
&lt;FILTER&gt;)


                    
                    
                        ${out.body}.size > 0
                        
                            
                        
                        
                        
                    


In my mind, this should only Marshal the data and create the output file if
the size of the Map in the Message body is greater than zero. The bean
(formatOutput) always adds a Map object to the body but this may contain no
elements.

Can you tell me what I am doing wrong please?

Thanks.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Conditional-processing-in-Spring-DSL-tp3295646p3295646.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Conditional processing in Spring DSL

Posted by Andy Bourke <an...@pcmsgroup.com>.
Thanks Claus, this works:

                    <choice>
                        <when>
                            <simple>${body.size} > 0</simple>
                            <marshal>
                                <csv />
                            </marshal>
                            <to
uri="file:/data/smartstore/outbound/?fileExist=Append"/>
                            <to uri="log:dump"/>
                        </when>
                    </choice>

-- 
View this message in context: http://camel.465427.n5.nabble.com/Conditional-processing-in-Spring-DSL-tp3295646p3298814.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Conditional processing in Spring DSL

Posted by Claus Straube <cl...@catify.com>.
Hi Andy,

try this:

                 from("direct:map")
                 .choice()
                     .when(simple("${body.size} == 0"))
                         .to("mock:null")
                     .otherwise()
                         .to("mock:notnull");

Best regards - Claus

On 07.12.2010 13:04, Andy Bourke wrote:
> Hi,
>
> I have been trying to influence whether or not the next endpoint gets
> processed based on some aspect of the mesage body using spring DSL and am
> having no luck with it. I have tried various incarnations of the following
> configuration (including&lt;CHOICE&gt;&lt;WHEN&gt; tags in place of
> &lt;FILTER&gt;)
>
>
>
>
>                          ${out.body}.size>  0
>
>
>
>
>
>
>
>
> In my mind, this should only Marshal the data and create the output file if
> the size of the Map in the Message body is greater than zero. The bean
> (formatOutput) always adds a Map object to the body but this may contain no
> elements.
>
> Can you tell me what I am doing wrong please?
>
> Thanks.


-- 
claus straube
__________________________________________

phone    +49-89-38157419
mobile   +49-176-49673717
web      http://www.catify.com
office   6. floor, heßstr. 56, 80798 munich
__________________________________________

catify | claus straube, sebastian münz