Closed
Description
(Describe your issue and goal here)
Category (place an x
in each of the [ ]
)
- bolt (Bolt for Java)
- bolt-jakarta-socket-mode (Bolt for Java - optional modules)
- slack-api-client (Slack API Clients)
- slack-api-model (Slack API Data Models)
- slack-api-*-kotlin-extension (Kotlin Extensions for Slack API Clients)
- slack-app-backend (The primitive layer of Bolt for Java)
Requirements
We are using java sdk in socket mode with tyrus client.
I just found out that it runs message processing single threaded and:
- it looks like it's not really intended.
com.slack.api.socket_mode.SocketModeClient#initializeMessageProcessorExecutor
It creates 10 (by default) jobs for processing messages with executor service created by the com.slack.api.util.thread.DaemonThreadExecutorServiceProvider#createThreadScheduledExecutor
which creates a single threaded executor
I've tried to test it by putting Thread.sleep for a couple of seconds in event processor and spamming messages and the message processing was very slow which proves the point.
It looks like a bug to me. - It's hard to configure concurrency – it's configured in the clients constructor, the client is created via JakartaSocketModeClientFactory#create(Slack, String) method which is called in private method SocketModeApp#buildSocketModeClientFactory that doesn't use any top-level properties that can overwrite the behaviour.
It would be nice to have an easy option to change concurrency. - It uses scheduled executor which significantly reduces the number of ExecutorServices that is possible to use for message processing. Is there a reason for using scheduled instead of a regular one? From my perspective switching to a regular one should simplify things, because it already encapsulates the queueing logic. + it would allow to use virtual threads executor
If the used executor type were changed and the ability to provide the concrete implementation were given, it would mitigate the second problem in this list from my perspective
Let me know if I can clarify anything else