Description
In this feature here: https://docs.powertools.aws.dev/lambda/java/preview/utilities/batch/#parallel-processing
It would be nice to have an option of providing my own ExecutorService instead of relying on the framework using its own thread pool.
One way how a user can provide this is something like this:
handler = new BatchMessageHandlerBuilder()
.withSqsBatchHandler()
.withExecutor(Executors.newFixedThreadPool(2)) // Can this be done?
.buildWithMessageHandler(this::processMessage, Product.class);
A couple of reasons (not exhaustive, ofcourse) why this is useful could be:
- User may want to have control over the concurrency
- User may want to control the names of the threads
PS - I am assuming parallel processing feature takes care of propagating the lambda context to all the threads via ThreadContext/MDC
if used in conjuction with Powertools-logging. Thus, I can basically provide my own executor service and the framework will take care of propagating context to the threads I provided and also processing my sqs message in parallel.
Let me know if this is possible to achieve.
Metadata
Metadata
Assignees
Type
Projects
Status