Skip to content

Commit cd15ee9

Browse files
committed
docs(batch): remove leftover from legacy
1 parent 17e5827 commit cd15ee9

File tree

1 file changed

+3
-72
lines changed

1 file changed

+3
-72
lines changed

Diff for: docs/utilities/batch.md

+3-72
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The remaining sections of the documentation will rely on these samples. For comp
5050
Function:
5151
Timeout: 5
5252
MemorySize: 256
53-
Runtime: python3.8
53+
Runtime: python3.9
5454
Tracing: Active
5555
Environment:
5656
Variables:
@@ -97,7 +97,7 @@ The remaining sections of the documentation will rely on these samples. For comp
9797
Function:
9898
Timeout: 5
9999
MemorySize: 256
100-
Runtime: python3.8
100+
Runtime: python3.9
101101
Tracing: Active
102102
Environment:
103103
Variables:
@@ -155,7 +155,7 @@ The remaining sections of the documentation will rely on these samples. For comp
155155
Function:
156156
Timeout: 5
157157
MemorySize: 256
158-
Runtime: python3.8
158+
Runtime: python3.9
159159
Tracing: Active
160160
Environment:
161161
Variables:
@@ -636,75 +636,6 @@ All records in the batch will be passed to this handler for processing, even if
636636
All processing logic will and should be performed by the `record_handler` function.
637637

638638

639-
<!-- ### IAM Permissions
640-
641-
Before your use this utility, your AWS Lambda function must have `sqs:DeleteMessageBatch` permission to delete successful messages directly from the queue.
642-
643-
> Example using AWS Serverless Application Model (SAM)
644-
645-
=== "template.yml"
646-
647-
```yaml hl_lines="2-3 12-15"
648-
Resources:
649-
MyQueue:
650-
Type: AWS::SQS::Queue
651-
652-
HelloWorldFunction:
653-
Type: AWS::Serverless::Function
654-
Properties:
655-
Runtime: python3.8
656-
Environment:
657-
Variables:
658-
POWERTOOLS_SERVICE_NAME: example
659-
Policies:
660-
- SQSPollerPolicy:
661-
QueueName:
662-
!GetAtt MyQueue.QueueName
663-
```
664-
665-
### Processing messages from SQS
666-
667-
You can use either `sqs_batch_processor` decorator, or `PartialSQSProcessor` as a context manager if you'd like access to the processed results.
668-
669-
You need to create a function to handle each record from the batch - We call it `record_handler` from here on.
670-
671-
=== "Decorator"
672-
673-
```python hl_lines="3 6"
674-
from aws_lambda_powertools.utilities.batch import sqs_batch_processor
675-
676-
def record_handler(record):
677-
return do_something_with(record["body"])
678-
679-
@sqs_batch_processor(record_handler=record_handler)
680-
def lambda_handler(event, context):
681-
return {"statusCode": 200}
682-
```
683-
=== "Context manager"
684-
685-
```python hl_lines="3 9 11-12"
686-
from aws_lambda_powertools.utilities.batch import PartialSQSProcessor
687-
688-
def record_handler(record):
689-
return_value = do_something_with(record["body"])
690-
return return_value
691-
692-
def lambda_handler(event, context):
693-
records = event["Records"]
694-
processor = PartialSQSProcessor()
695-
696-
with processor(records, record_handler) as proc:
697-
result = proc.process() # Returns a list of all results from record_handler
698-
699-
return result
700-
```
701-
702-
!!! tip
703-
**Any non-exception/successful return from your record handler function** will instruct both decorator and context manager to queue up each individual message for deletion.
704-
705-
If the entire batch succeeds, we let Lambda to proceed in deleting the records from the queue for cost reasons. -->
706-
707-
708639
## Advanced
709640

710641
### Pydantic integration

0 commit comments

Comments
 (0)