8000 [ESM] Dynamically set SQS message override count by gregfurman · Pull Request #12233 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

[ESM] Dynamically set SQS message override count #12233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

gregfurman
Copy link
Contributor

Motivation

Currently, event hooks used to override the number of SQS messages to delete/receive use static parameters from the SqsPoller class to determine override values. Since boto clients in the same session can be re-used, this approach could possibly cause data races if multiple clients register against the same event source with different BatchSize parameters.

Instead, this PR introduces event hooks that allow the override parameter to be dynamically passed in to each boto call (and injected into the headers) instead of trying to retrieve this information from the static ESM values.

Changes

  • Remove header injection implementation that relied on retrieving static values from the SqsPoller.sqs_queue_parameters.
  • Introduce a sqs_override_max_message_count parameter to ReceiveMessage and DeleteMessageBatch requests to allow overriding message count on a per-boto-request basis.

@gregfurman gregfurman self-assigned this Feb 6, 2025
@gregfurman gregfurman added semver: patch Non-breaking changes which can be included in patch releases aws:lambda:event-source-mapping AWS Lambda Event Source Mapping (ESM) labels Feb 6, 2025
Copy link
github-actions bot commented Feb 6, 2025

LocalStack Community integration with Pro

    2 files  ±  0      2 suites  ±0   1h 30m 53s ⏱️ - 23m 8s
3 094 tests  - 989  2 874 ✅  - 892  220 💤  - 97  0 ❌ ±0 
3 096 runs   - 989  2 874 ✅  - 892  222 💤  - 97  0 ❌ ±0 

Results for commit a75463f. ± Comparison against base commit 7f32b7d.

This pull request removes 989 tests.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…

♻️ This comment has been updated with latest results.

@gregfurman gregfurman marked this pull request as ready for review February 7, 2025 08:43
Copy link
Member
@joe4dev joe4dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the explicit clarity around overwrites here 💯

My main suggestion is to double-check the min / max condition for MaxNumberOfMessages to enable our SQS poller to work against real AWS SQS queues.

@gregfurman gregfurman requested a review from joe4dev February 7, 2025 14:17
@gregfurman gregfurman merged commit d8265eb into master Feb 7, 2025
31 checks passed
@gregfurman gregfurman deleted the esm/refactor/sqs-override-msg-count branch February 7, 2025 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:lambda:event-source-mapping AWS Lambda Event Source Mapping (ESM) semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0