You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dnn <Da...@ngc.com> on 2010/04/21 22:19:50 UTC

Handle finite number of remote requests?

My application will send requests to a remote system via XML-RPC, but the
remote system does not queue or throttle requests in any way -- it is fairly
trivial for my application to overload the remote system and make it crash. 
I don't think that the throttler pattern will work for my intended usage
because I need to synchronize externally (clustered app; a DB tracks
requests and the maximum number of requests per remote server) and because
the remote system calls can take a different amount of time (throttler
appears to work on max requests per unit time).  I also cannot blindly wait
for the resource to become available because my XA transaction will timeout.

Since my source endpoint is a JMS queue, I was thinking of implementing a
"gate" that utilizes a QueueBrowser to peek at the messages.  When it finds
a message that can be processed, it consumes the message and puts it on
another queue.  The logic that sends it to the remote system can watch the
second queue and blindly send the data.

Has anyone encountered any situation like this before?  Are there any
recommend solutions?

Thanks,
Dan Nawrocki

-- 
View this message in context: http://old.nabble.com/Handle-finite-number-of-remote-requests--tp28301621p28301621.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Handle finite number of remote requests?

Posted by dnn <Da...@ngc.com>.
That's pretty close to what I want to do, but the
ThrottlingInflightRoutePolicy appears to throttle at the end of the route
(or so it seems from the 'onExchangeDone' method).  I think I could make it
work by writing my own policy to check the DB in the 'onExchangeBegin'
method.

Thanks Claus!


Claus Ibsen-2 wrote:
> 
> Hi
> 
> Something similar you can do is to throttle intaking messages
> according to some metrics, such as the rate of speed
> that external server can handle.
> 
> Check out RoutePolicy
> http://camel.apache.org/routepolicy.html
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/Handle-finite-number-of-remote-requests--tp28301621p28329877.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Handle finite number of remote requests?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Something similar you can do is to throttle intaking messages
according to some metrics, such as the rate of speed
that external server can handle.

Check out RoutePolicy
http://camel.apache.org/routepolicy.html


On Wed, Apr 21, 2010 at 10:19 PM, dnn <Da...@ngc.com> wrote:
>
> My application will send requests to a remote system via XML-RPC, but the
> remote system does not queue or throttle requests in any way -- it is fairly
> trivial for my application to overload the remote system and make it crash.
> I don't think that the throttler pattern will work for my intended usage
> because I need to synchronize externally (clustered app; a DB tracks
> requests and the maximum number of requests per remote server) and because
> the remote system calls can take a different amount of time (throttler
> appears to work on max requests per unit time).  I also cannot blindly wait
> for the resource to become available because my XA transaction will timeout.
>
> Since my source endpoint is a JMS queue, I was thinking of implementing a
> "gate" that utilizes a QueueBrowser to peek at the messages.  When it finds
> a message that can be processed, it consumes the message and puts it on
> another queue.  The logic that sends it to the remote system can watch the
> second queue and blindly send the data.
>
> Has anyone encountered any situation like this before?  Are there any
> recommend solutions?
>
> Thanks,
> Dan Nawrocki
>
> --
> View this message in context: http://old.nabble.com/Handle-finite-number-of-remote-requests--tp28301621p28301621.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus