Hi,

I am currently having some problems with dynamic throttling. I created a
route which uses the throttle processor, and set a header to be used to
determine the rate. Depending on the situation the rate will change between
two distinct values. This does not work very well though. I created some
unit tests to check it, and they finish far too quick.

I took a look at the ThrottlerTest in the camel test to evaluate if this is
a problem of my implementation or not. As soon as I change the test
testConfigurationWithHeaderExpression to use a dynamic value instead of "1"
for the rate, I get test errors. Here is my changed version of the test,
with the output (I increased the messageCount to 90):


The result of running the test is:
junit.framework.AssertionFailedError: Should take at least 44500ms, was: 284
        at
org.apache.camel.processor.ThrottlerTest.testConfigurationWithHeaderExpression(ThrottlerTest.java:161)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.apache.camel.TestSupport.runBare(TestSupport.java:58)
        at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
        at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
        at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
        at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Am I using it wrong, or is there a bug?

Cheers,
Michael



--
View this message in context: 
http://camel.465427.n5.nabble.com/Problems-with-dynamic-throttling-tp5746613.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to