Skip to content
Permalink
Browse files

Allow thread size to be configurable for AwsSqsJobQueue

It'd be nice to have a config for the number of threads instead of hardcoding it.

Feedback comment: #966 (comment)
Issue ref: #284
  • Loading branch information...
Masaru Nomura
Masaru Nomura committed May 5, 2019
1 parent e263744 commit 466813e6936a056d0fe75df666cffb6b5e640cea
@@ -17,6 +17,11 @@ class AwsSqsJobQueueConfig(
* External queues is a set of externally owned SQS queues accessed by this service, mapping
* an internal queue name to the (account ID, region, name) of the queue in the external account
*/
val external_queues: Map<String, AwsSqsQueueConfig> = mapOf()
val external_queues: Map<String, AwsSqsQueueConfig> = mapOf(),

/**
* Number of jobs that can be processed concurrently.
*/
val consumer_thread_pool_size: Int = 4
) : Config

@@ -31,7 +31,10 @@ class AwsSqsJobQueueModule(
bind<TransactionalJobQueue>().to<SqsTransactionalJobQueue>()
multibind<Service>().to<SqsJobConsumer>()

install(ExecutorServiceModule.withFixedThreadPool(ForSqsConsumer::class, "sqs-consumer-%d", 4))
install(ExecutorServiceModule.withFixedThreadPool(
ForSqsConsumer::class,
"sqs-consumer-%d",
config.consumer_thread_pool_size))

// Bind a map of AmazonSQS clients for each external region that we need to contact
val regionSpecificClientBinder = newMapBinder<AwsRegion, AmazonSQS>()

0 comments on commit 466813e

Please sign in to comment.
You can’t perform that action at this time.