On 3/28/07, spiderman2 <[EMAIL PROTECTED]> wrote:
I want to have a server of several consumer threads which pull Jobs from various Brokers. However, I want to limit the number of Jobs of a certain type, that are running concurrently on this server. So for example, not more than 5 Priority 1 jobs should be running at the same time on a server. (In case these are very long Jobs and monopolize my consumer thread pool). However, I don't want to have 5 Consumers looking *only* for priority 1 threads which would otherwise sit idle if there are none.
You could create multiple consumers on each session to reflect your allowed concurrency on each thread (then for a given thread you can decide which kinds of messages you're allowing it to process). e.g. 5 threads with priority 1 and 2 messages, 2 threads for just priority 3 etc. The other option is you pull messages from consumers on demand. Another idea is you just have some kind of lock/latch so that you block threads from processing within your message listener. e.g. like Springs interceptor... http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptor.html -- James ------- http://radio.weblogs.com/0112098/