|
1 | 1 | /*******************************************************************************
|
2 |
| - * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | + * Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License").
|
5 | 5 | * You may not use this file except in compliance with the License.
|
@@ -45,6 +45,7 @@ public class PropertiesFileConfiguration implements ProcessingConfiguration{
|
45 | 45 | public static final String VISIBILITY_TIMEOUT = "visibilityTimeout";
|
46 | 46 | public static final String S3_REGION = "s3Region";
|
47 | 47 | public static final String THREAD_COUNT = "threadCount";
|
| 48 | + public static final String NUM_OF_PARALLEL_READERS = "numOfParallelReaders"; |
48 | 49 | public static final String THREAD_TERMINATION_DELAY_SECONDS = "threadTerminationDelaySeconds";
|
49 | 50 | public static final String MAX_EVENTS_PER_EMIT = "maxEventsPerEmit";
|
50 | 51 | public static final String ENABLE_RAW_EVENT_INFO = "enableRawEventInfo";
|
@@ -98,6 +99,12 @@ public class PropertiesFileConfiguration implements ProcessingConfiguration{
|
98 | 99 | */
|
99 | 100 | private int threadCount = DEFAULT_THREAD_COUNT;
|
100 | 101 |
|
| 102 | + |
| 103 | + /** |
| 104 | + * The number of threads used to get SQS messages |
| 105 | + */ |
| 106 | + private int numOfParallelReaders = DEFAULT_NUM_OF_PARALLEL_READERS; |
| 107 | + |
101 | 108 | /**
|
102 | 109 | * The time allowed, in seconds, for threads to shut down after {@link AWSCloudTrailProcessingExecutor#stop()} is
|
103 | 110 | * called.
|
@@ -147,6 +154,7 @@ public PropertiesFileConfiguration(String propertiesFile) {
|
147 | 154 | sqsRegion = prop.getProperty(SQS_REGION);
|
148 | 155 |
|
149 | 156 | threadCount = getIntProperty(prop, THREAD_COUNT);
|
| 157 | + numOfParallelReaders = getIntProperty(prop, NUM_OF_PARALLEL_READERS); |
150 | 158 | threadTerminationDelaySeconds = getIntProperty(prop, THREAD_TERMINATION_DELAY_SECONDS);
|
151 | 159 |
|
152 | 160 | maxEventsPerEmit = getIntProperty(prop, MAX_EVENTS_PER_EMIT);
|
@@ -203,6 +211,13 @@ public int getThreadCount() {
|
203 | 211 | return threadCount;
|
204 | 212 | }
|
205 | 213 |
|
| 214 | + /** |
| 215 | + * {@inheritDoc} |
| 216 | + */ |
| 217 | + public int getNumOfParallelReaders(){ |
| 218 | + return numOfParallelReaders; |
| 219 | + } |
| 220 | + |
206 | 221 | /**
|
207 | 222 | * {@inheritDoc}
|
208 | 223 | */
|
@@ -246,7 +261,8 @@ public void validate() {
|
246 | 261 | LibraryUtils.checkArgumentNotNull(getS3Region(), "S3 Region is null.");
|
247 | 262 |
|
248 | 263 | LibraryUtils.checkCondition(getMaxEventsPerEmit() <= 0, "Maximum Events Per Emit is a non-positive integer.");
|
249 |
| - LibraryUtils.checkCondition(getThreadCount() <= 0, "Thread Count is a non-positive integer."); |
| 264 | + LibraryUtils.checkCondition(getThreadCount() <= 0, "Num of Parallel Readers Count is a non-positive integer."); |
| 265 | + LibraryUtils.checkCondition(getNumOfParallelReaders() <= 0, "Thread Count is a non-positive integer."); |
250 | 266 | LibraryUtils.checkCondition(getThreadTerminationDelaySeconds() <= 0, "Thread Termination Delay Seconds is a non-positive integer.");
|
251 | 267 | LibraryUtils.checkCondition(getVisibilityTimeout() <= 0, "Visibility Timeout is a non-positive integer.");
|
252 | 268 | }
|
|
0 commit comments