-
Notifications
You must be signed in to change notification settings - Fork 156
feat(batch): add option to continue processing other group IDs on failure in SqsFifoPartialProcessor
#2590
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
dreamorosi
merged 28 commits into
aws-powertools:main
from
arnabrahman:2561-improve-sqs-fifo-processing
Jun 4, 2024
Merged
feat(batch): add option to continue processing other group IDs on failure in SqsFifoPartialProcessor
#2590
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
c2339ed
feat: generic type for BatchProcessingOptions
arnabrahman c080b8d
refactor: update processPartialResponseSync function for new generic …
arnabrahman b9197ce
feat: SqsFifoMessageGroupShortCircuitError exception
arnabrahman f9a5ab0
feat: stick to the default behavior of short-circuit
arnabrahman 2405629
feat: skip processing record of group if it has already failed before
arnabrahman c5b5041
test: skipGroupOnError flag for SqsFifoPartialProcessor
arnabrahman 6a5477b
doc: describe skipGroupOnError with example/diagram
arnabrahman ca18ea7
test: SQS Fifo for different scenarios by `skipGroupOnError` flag
arnabrahman 249ca8b
doc: fix SQS FIFO queues aws documentation link
arnabrahman a5203e2
doc: update comments of SqsFifoPartialProcessor
arnabrahman 8713413
test: change the last record to success
arnabrahman e3224f0
fix: merge conflict with main branch
arnabrahman ffe9366
doc: update comments for `skipGroupOnError` flag
arnabrahman adf5d3e
test: FIFO Batch processor processes everything on success despite th…
arnabrahman 4cf9839
style: space after example
arnabrahman 4f50be8
Merge branch 'main' into 2561-improve-sqs-fifo-processing
dreamorosi 082f8b7
fix: check if messageGroupId exists
arnabrahman 9a0ac3b
doc: styling for processFailRecord docString
arnabrahman c6d8c74
doc: enhance processPartialResponseSync docstring
arnabrahman ff76ead
fix: code highlight numbers
arnabrahman c7dfdd3
fix: indentation of batch readme
arnabrahman a2d4e5b
doc: move annotation to fix rendering
arnabrahman 03b471c
refactor: make `context' optional
arnabrahman a1ab420
fix: remove `context` from `skipGroupOnError` tests
arnabrahman f442956
refactor: change TS privates to JS private fields
arnabrahman b7cd35b
Merge branch 'main' into 2561-improve-sqs-fifo-processing
dreamorosi 0354524
style: fix docstring spacing
arnabrahman 984fd53
Merge branch '2561-improve-sqs-fifo-processing' of github.com:arnabra…
arnabrahman 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
32 changes: 32 additions & 0 deletions
32
examples/snippets/batch/gettingStartedSQSFifoSkipGroupOnError.ts
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,32 @@ | ||
import { | ||
SqsFifoPartialProcessor, | ||
processPartialResponseSync, | ||
} from '@aws-lambda-powertools/batch'; | ||
import { Logger } from '@aws-lambda-powertools/logger'; | ||
import type { | ||
SQSEvent, | ||
SQSRecord, | ||
Context, | ||
SQSBatchResponse, | ||
} from 'aws-lambda'; | ||
|
||
const processor = new SqsFifoPartialProcessor(); | ||
const logger = new Logger(); | ||
|
||
const recordHandler = (record: SQSRecord): void => { | ||
const payload = record.body; | ||
if (payload) { | ||
const item = JSON.parse(payload); | ||
logger.info('Processed item', { item }); | ||
} | ||
}; | ||
|
||
export const handler = async ( | ||
event: SQSEvent, | ||
context: Context | ||
): Promise<SQSBatchResponse> => { | ||
return processPartialResponseSync(event, recordHandler, processor, { | ||
context, | ||
skipGroupOnError: true, | ||
}); | ||
}; |
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
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
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
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.