Throttling: maximumRequestsPerPeriod problem

Throttling: maximumRequestsPerPeriod problem

Hi!

I´m trying to use Throttle in my xml CamelContext under 2.9 Camel version, but when I set the maximumRequestsPerPeriod property my compilation fails displaying this message:
cvc-complex-type.3.2.2: Attribute 'maximumRequestsPerPeriod' is not allowed to appear in element
'camel:throttle'.

if I delete the maximumRequestsPerPeriod property my route fails at runtime displaying this message:
Caused by: java.lang.IllegalStateException: The maximumRequestsPerPeriod must be a positive number, was: 0

Re: Throttling: maximumRequestsPerPeriod problem

About your tests, I couldn´t execute it because some imports in your source code make reference to older camel version. An example, the org.apache.camel.processor.ThrottlerTest class does not exist in Camel 2.9.

Re: Throttling: maximumRequestsPerPeriod problem

This post was updated on .

These namespaces are already declared. The browser you´re using probably hides the namespace declarations. If you right click my attached xml and choose "Show Source Code" (or something like, depending on your browser) the namespaces will be shown.

Re: Throttling: maximumRequestsPerPeriod problem

In fact, I was sending my body using ProducerTemplate.sendBody(Endpoint endpoint, Object body). So garryHeader does not exist. I had to debug org.apache.camel.processor.Throttler to discover that [1].

I don´t think the throwing of Caused by: java.lang.IllegalStateException: The maximumRequestsPerPeriod must be a positive number, was: 0 is a good behavior. Camel could at least throw a NPE or some kind of warning. As you could see, find the real cause of the problem is not as obvious as it should be.