-
Notifications
You must be signed in to change notification settings - Fork 432
feat(batch): add flag in SqsFifoProcessor to enable continuous message processing #3954
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
leandrodamascena
merged 18 commits into
aws-powertools:develop
from
leandrodamascena:improve-sqs-fifo-batch
Mar 20, 2024
Merged
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f8a7390
Adding a flag to SqsFifoProcessor to allow message processing to cont…
leandrodamascena de5d756
Adding docstring
leandrodamascena 1ad32f5
Refactoring logic to skip execution when messages are part of a group…
leandrodamascena 8084a96
Reducing complexity
leandrodamascena a8d8c9d
Merge branch 'develop' into improve-sqs-fifo-batch
leandrodamascena 1b13512
Adding documentation
leandrodamascena 66642a6
Merge branch 'develop' into improve-sqs-fifo-batch
leandrodamascena 6ad583b
Addressing Mathieu's feedback
leandrodamascena a43bbdb
Addressing Mathieu's feedback
leandrodamascena 3d8c144
Merge branch 'develop' into improve-sqs-fifo-batch
leandrodamascena fc919c5
Merge branch 'develop' into improve-sqs-fifo-batch
leandrodamascena 28d68af
Addressing Ruben's feedback
leandrodamascena 1ca372c
chore: refactor
rubenfonseca b3fdd57
chore: refactor
rubenfonseca 8c4df8e
Adding temp test to help Ruben test it
leandrodamascena f8e8872
fix: condition
rubenfonseca 90db3e0
chore: moved exceptions
rubenfonseca 66ba049
Merge branch 'develop' into improve-sqs-fifo-batch
leandrodamascena File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
examples/batch_processing/src/getting_started_sqs_fifo_skip_on_error.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from aws_lambda_powertools import Logger, Tracer | ||
from aws_lambda_powertools.utilities.batch import ( | ||
SqsFifoPartialProcessor, | ||
process_partial_response, | ||
) | ||
from aws_lambda_powertools.utilities.data_classes.sqs_event import SQSRecord | ||
from aws_lambda_powertools.utilities.typing import LambdaContext | ||
|
||
processor = SqsFifoPartialProcessor(skip_group_on_error=True) | ||
tracer = Tracer() | ||
logger = Logger() | ||
|
||
|
||
@tracer.capture_method | ||
def record_handler(record: SQSRecord): | ||
payload: str = record.json_body # if json string data, otherwise record.body for str | ||
logger.info(payload) | ||
|
||
|
||
@logger.inject_lambda_context | ||
@tracer.capture_lambda_handler | ||
def lambda_handler(event, context: LambdaContext): | ||
return process_partial_response(event=event, record_handler=record_handler, processor=processor, context=context) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.