camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Baris Acar <>
Subject Dynamic suspension of JMS producer
Date Mon, 30 Sep 2013 20:00:47 GMT

We have two instances of a service, one for low and one for high priority users. Both post
messages to a single shared queue, with the appropriate priority level set so that high priority
requests jump in front.

If the queue is completely full of low priority requests, it's impossible for high priority
requests to arrive. I'd like to prevent this.

One way is to limit the number of low priority messages allowed on the queue. We would like
to stop the low priority service posting if the (jms) queue is >90% full. This always leaves
some headroom on the queue for some high priority messages. We've had success with this model
in other (non-camel) applications.

How best could I do this with Camel? Also very open to completely alternative proposals solving
the use case. 

I don't think that there is a JMS-only way to inspect queue depth - we'll have to use vendor-specific
code to interrogate queue depth (we use IBM MQ and Solace).

The first ideas I had were:
- use a RoutePolicy to suspend the part of the route that's posting - but casual playing found
that suspending in this way caused exceptions rather than blocking behaviour when a route
was suspended (I might be doing something wrong).
- write a processor which sits just before the "jms:..." endpoint, which inspects the queue
and blocks as appropriate. This seems a bit ugly (it needs to know about specific downstream
endpoints, which is "weird"). 

Is there something more Camel-y? Any thoughts or ideas most welcome. 

View raw message