camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier.Roger" <olivier.ro...@bsb.com>
Subject Throttler in a Choice ?
Date Fri, 29 Oct 2010 14:47:07 GMT

Hello Camel,

I am using Camel 2.4 and writting my first Java DSL route
I would like to translate the following route from Spring DSL:

		<choice>
			<when>
			    <simple>${header.JMSPriority} &lt; 5</simple>
                    <throttle maximumRequestsPerPeriod="50"
timePeriodMillis="60000">
                        <to ref="nsResolved" />
                    </throttle>
                </when>
                <otherwise>
                    <to ref="nsResolved" />
                </otherwise>
            </choice>

Here is what I did :

    @Override
    public void configure() throws Exception {
        from("direct:throttler.in")
            .choice()
                .when(simple("header.JMSPriority >= 5"))
                    .throttle(50).timePeriodMillis(60000)
                    .to("direct:nsResolved")
                    //.end()
                .otherwise()
                    .to("direct:nsResolved")
            .end();
    }

In both case I can use otherwise() because I dont have a ChoiceDefinition
object.
Like that I get a ThrottlerDefinition, which implements block, so I should
close is with end() I suppose. 
In that case I get a ProcessDefinition not a ChoiceDefinition.

Am I doing something wrong here ?

Thanks for your help,

Olivier
-- 
View this message in context: http://camel.465427.n5.nabble.com/Throttler-in-a-Choice-tp3242130p3242130.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message