Skip to content

Commit 7ee6ff2

Browse files
committed
docs: update call outs to batch_processor and async_batch_processor
1 parent 25b4ee1 commit 7ee6ff2

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

docs/utilities/batch.md

+12-16
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,11 @@ The remaining sections of the documentation will rely on these samples. For comp
219219

220220
### Processing messages from SQS
221221

222-
Processing batches from SQS works in four stages:
222+
Processing batches from SQS works in three stages:
223223

224224
1. Instantiate **`BatchProcessor`** and choose **`EventType.SQS`** for the event type
225225
2. Define your function to handle each batch record, and use [`SQSRecord`](data_classes.md#sqs){target="_blank"} type annotation for autocompletion
226-
3. Use either **`batch_processor`** decorator or your instantiated processor as a context manager to kick off processing
227-
4. Return the appropriate response contract to Lambda via **`.response()`** processor method
226+
3. Use **`process_partial_response`** to kick off processing
228227

229228
???+ info
230229
This code example optionally uses Tracer and Logger for completion.
@@ -241,7 +240,7 @@ Processing batches from SQS works in four stages:
241240
import json
242241

243242
from aws_lambda_powertools import Logger, Tracer
244-
from aws_lambda_powertools.utilities.batch import BatchProcessor, EventType, batch_processor
243+
from aws_lambda_powertools.utilities.batch import BatchProcessor, EventType
245244
from aws_lambda_powertools.utilities.data_classes.sqs_event import SQSRecord
246245
from aws_lambda_powertools.utilities.typing import LambdaContext
247246

@@ -378,12 +377,11 @@ This helps preserve the ordering of messages in your queue.
378377

379378
### Processing messages from Kinesis
380379

381-
Processing batches from Kinesis works in four stages:
380+
Processing batches from Kinesis works in three stages:
382381

383382
1. Instantiate **`BatchProcessor`** and choose **`EventType.KinesisDataStreams`** for the event type
384383
2. Define your function to handle each batch record, and use [`KinesisStreamRecord`](data_classes.md#kinesis-streams){target="_blank"} type annotation for autocompletion
385-
3. Use either **`batch_processor`** decorator or your instantiated processor as a context manager to kick off processing
386-
4. Return the appropriate response contract to Lambda via **`.response()`** processor method
384+
3. Use **`process_partial_response`** to kick off processing
387385

388386
???+ info
389387
This code example optionally uses Tracer and Logger for completion.
@@ -400,7 +398,7 @@ Processing batches from Kinesis works in four stages:
400398
import json
401399

402400
from aws_lambda_powertools import Logger, Tracer
403-
from aws_lambda_powertools.utilities.batch import BatchProcessor, EventType, batch_processor
401+
from aws_lambda_powertools.utilities.batch import BatchProcessor, EventType
404402
from aws_lambda_powertools.utilities.data_classes.kinesis_stream_event import KinesisStreamRecord
405403
from aws_lambda_powertools.utilities.typing import LambdaContext
406404

@@ -510,12 +508,11 @@ Processing batches from Kinesis works in four stages:
510508

511509
### Processing messages from DynamoDB
512510

513-
Processing batches from Kinesis works in four stages:
511+
Processing batches from Kinesis works in three stages:
514512

515513
1. Instantiate **`BatchProcessor`** and choose **`EventType.DynamoDBStreams`** for the event type
516514
2. Define your function to handle each batch record, and use [`DynamoDBRecord`](data_classes.md#dynamodb-streams){target="_blank"} type annotation for autocompletion
517-
3. Use either **`batch_processor`** decorator or your instantiated processor as a context manager to kick off processing
518-
4. Return the appropriate response contract to Lambda via **`.response()`** processor method
515+
3. Use **`process_partial_response`** to kick off processing
519516

520517
???+ info
521518
This code example optionally uses Tracer and Logger for completion.
@@ -532,7 +529,7 @@ Processing batches from Kinesis works in four stages:
532529
import json
533530

534531
from aws_lambda_powertools import Logger, Tracer
535-
from aws_lambda_powertools.utilities.batch import BatchProcessor, EventType, batch_processor
532+
from aws_lambda_powertools.utilities.batch import BatchProcessor, EventType
536533
from aws_lambda_powertools.utilities.data_classes.dynamo_db_stream_event import DynamoDBRecord
537534
from aws_lambda_powertools.utilities.typing import LambdaContext
538535

@@ -673,7 +670,7 @@ All records in the batch will be passed to this handler for processing, even if
673670

674671
!!! tip "New to AsyncIO? Read this [comprehensive guide first](https://realpython.com/async-io-python/){target="_blank"}."
675672

676-
You can use `AsyncBatchProcessor` class and `async_batch_processor` decorator to process messages concurrently.
673+
You can use `AsyncBatchProcessor` class and `async_process_partial_response` function to process messages concurrently.
677674

678675
???+ question "When is this useful?"
679676
Your use case might be able to process multiple records at the same time without conflicting with one another.
@@ -845,7 +842,7 @@ Use the context manager to access a list of all returned values from your `recor
845842
* **When successful**. We will include a tuple with `success`, the result of `record_handler`, and the batch record
846843
* **When failed**. We will include a tuple with `fail`, exception as a string, and the batch record
847844

848-
```python hl_lines="31-38" title="Accessing processed messages via context manager"
845+
```python hl_lines="30-36" title="Accessing processed messages via context manager"
849846
import json
850847

851848
from typing import Any, List, Literal, Union
@@ -854,8 +851,7 @@ from aws_lambda_powertools import Logger, Tracer
854851
from aws_lambda_powertools.utilities.batch import (BatchProcessor,
855852
EventType,
856853
FailureResponse,
857-
SuccessResponse,
858-
batch_processor)
854+
SuccessResponse)
859855
from aws_lambda_powertools.utilities.data_classes.sqs_event import SQSRecord
860856
from aws_lambda_powertools.utilities.typing import LambdaContext
861857

0 commit comments

Comments
 (0)