Skip to content

Commit 915e7d2

Browse files
authored
Always wire ExecutorService for @ForSqsHandling and @ForSqsReceiving (#3482)
The dependencies are needed for other objects that are being installed like SqsJobConsumer
1 parent 3ff03e8 commit 915e7d2

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

misk-aws/src/main/kotlin/misk/jobqueue/sqs/AwsSqsJobQueueModule.kt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,6 @@ open class AwsSqsJobQueueModule(
3939
install(CommonModule(config, ::configureSyncClient, ::configureAsyncClient))
4040

4141
install(ServiceModule(keyOf<RepeatedTaskQueue>(ForSqsHandling::class)).dependsOn<ReadyService>())
42-
43-
// We use an unbounded thread pool for the number of consumers, as we want to process
44-
// the messages received as fast a possible.
45-
install(
46-
ExecutorServiceModule.withUnboundThreadPool(
47-
ForSqsHandling::class,
48-
"sqs-consumer-%d",
49-
),
50-
)
51-
52-
// We use an unbounded thread pool for number of receivers, as this will be controlled dynamically
53-
// using a feature flag.
54-
install(
55-
ExecutorServiceModule.withUnboundThreadPool(
56-
ForSqsReceiving::class,
57-
"sqs-receiver-%d",
58-
),
59-
)
6042
}
6143

6244
@OptIn(ExperimentalMiskApi::class)
@@ -87,6 +69,24 @@ open class AwsSqsJobQueueModule(
8769
bind<JobQueue>().to<SqsJobQueue>()
8870
bind<TransactionalJobQueue>().to<SqsTransactionalJobQueue>()
8971

72+
// We use an unbounded thread pool for the number of consumers, as we want to process
73+
// the messages received as fast a possible.
74+
install(
75+
ExecutorServiceModule.withUnboundThreadPool(
76+
ForSqsHandling::class,
77+
"sqs-consumer-%d",
78+
),
79+
)
80+
81+
// We use an unbounded thread pool for number of receivers, as this will be controlled dynamically
82+
// using a feature flag.
83+
install(
84+
ExecutorServiceModule.withUnboundThreadPool(
85+
ForSqsReceiving::class,
86+
"sqs-receiver-%d",
87+
),
88+
)
89+
9090
// Bind a map of AmazonSQS clients for each external region that we need to contact
9191
val regionSpecificClientBinder = newMapBinder<AwsRegion, AmazonSQS>()
9292
config.external_queues

0 commit comments

Comments
 (0)