I have currently a tough time with implementing the following scenario in Java:
I have a single producer with multiple consumer problem - but not not every consumer can process every job:
There are two types of jobs:
- xxl-jobs require a very large amount of memory
- normal-job don't require that much memory
And of course two types of consumers:
- xxl-consumer can process any type of job
- normal-consumer can only process normal-jobs
Is there an easy way to put that scenario in code?
The obvious approach would be to use two queues (one for each job type) and filter the jobs. However this would mean that the xxl-consumer would have to query two queues for new jobs - which is AFAIK not possible in Java in an efficient way (the posted work-arounds here on SO don't work as I have the normal-consumers who only listen for one queue).