camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Throtteling and dynamically changing MaxRequestsPerPeriod via Bean
Date Fri, 17 Apr 2015 13:13:31 GMT
Hi

Are you sure the getMessagesPerSecond returns a number that is > 0 ?

On Fri, Apr 17, 2015 at 3:02 PM, Alex Cali <alstie@gmail.com> wrote:
> I would like to change the MaxRequestsPerPeriod inside a Throttler.
>
> I would like to use spring and having such a simple route, with some beans.
>>>snip>>
>     <bean id="hello" class="example.HelloImpl"/>
>     <bean id="endMe" class="example.EndMe" />
>     <bean id="configurationSource" class="example.ConfigurationSource" />
>
>     <camelContext xmlns="http://camel.apache.org/schema/spring">
>         <route>
>             <from uri="direct:start"/>
>             <throttle timePeriodMillis="1000">
>                 <method ref="configurationSource"
> method="getMessagesPerSecond"/>
>                 <to uri="endMe"/>
>             </throttle>
>         </route>
>     </camelContext>
> <<snip&lt;&lt;
>
> But I cant get it to work, I will always get an error:
> java.lang.IllegalArgumentException: MaxRequestsPerPeriod expression must be
> provided on Throttle[bean{configurationSource, method=getMessagesPerSecond}
> request per 1000 millis -> [To[endMe]]]
>
> Using
> <constant>3</constant> instead of the method expression works.
>
> Did I misunderstood the concept of expressions?
>
> Thx,
> Alex
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Throtteling-and-dynamically-changing-MaxRequestsPerPeriod-via-Bean-tp5765952.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message