I have a DMLC app that needs to process incoming messages in parallel based on a parameter in the message.
This parameter can range from [1..16]. Messages with the same parameter value must be processed serially.
So, my design has 16 FixedPoolExecutorServices, each with a single thread.
My DMLC is configured with ONE single thread that reads off the queue, unpacks the parameter and puts it on one of the 16 executor services based on the value of the parameter.
Each of these 16 threads may throw an exception and I want that exception propagated back to the onMessage so that the message can be rolled back and redelivered on MQ.
Is this the correct approach?
The reason I don't believe it is is because once the onMessage submits the callable, it returns immediately and submits another one. When it gets an exception, it cannot determine which message triggered the exception.