I'm trying to set up thread pooling so that I can have many threads consuming and processing messages from a JMS queue. I thought I had found the solution upon reading about ThreadPoolTaskExecutor however I can't seem to find a way of prioritising thread execution. If I can briefly explain an abstraction of what I'm trying to do:
1. The jms queue is being populated from an external source with messages of the format {customerId, foodId}, for example customer 1 has bought an apple. Customer 1 may also have bought a pear but this would be a separate message.
2. Only one thread in the pool can be processing the same customerId at any one time.
It is step 2 that I'm really struggling with as I can't see a way for a ThreadPoolTaskExecutor to prevent execution of a message {customer1, pear} until {customer1, apple} has finished executing.
Can anyone point me in the right direction?
Cheers,
James
