feat: adding the ability to execute the consumer concurrently #449
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #397
Description:
The aim of this PR is to add the ability to execute SQS Consumer concurrently, meaning that it will keep triggering polls past the batch size and while other messages are being processed, up to a concurrent limit.
Type of change:
Why is this change required?:
Currently, SQS Consumer restricts the amount of messages that can be processed to the batch size from AWS, this means that users are limited to processing a maximum of 10 messages at a time.
Code changes:
Added a new constants file that contains an enum for polling status values
Added a new option for
concurrency
that allows the user to configure the limitsSplit the poll timeout functionality into a new function so it can be called from multiple places
Added tracking for the amount of concurrent executions
Adjusted the logic to queue a poll while messages are processing.
Updated status method to return concurrency and polling status
Add a new timeout value option for the amount of time to wait when the concurrent count has been reached (currently this is the normal timeout count, which may be wrong for some users)
Add unit/integration tests
Check that this works in the real world with a canary release (while still in PR)
Our users don't have concurrency right now, how might this affect them? This is most likely a breaking change any way, but we should check that there are no negative effects.