Skip to content
Prev Previous commit
Next Next commit
docs: allow boto3_session parameter to be passed through decorator
  • Loading branch information
Tom McCarthy committed Oct 1, 2021
commit 89b1e5f00328485a80288afd7630a136b0b44bc7
7 changes: 6 additions & 1 deletion aws_lambda_powertools/utilities/batch/sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def sqs_batch_processor(
record_handler: Callable,
config: Optional[Config] = None,
suppress_exception: bool = False,
boto3_session: Optional[boto3.session.Session] = None,
):
"""
Middleware to handle SQS batch event processing
Expand All @@ -168,6 +169,8 @@ def sqs_batch_processor(
botocore config object
suppress_exception: bool, optional
Supress exception raised if any messages fail processing, by default False
boto3_session : boto3.session.Session, optional
Boto3 session to use for AWS API communication

Examples
--------
Expand All @@ -188,7 +191,9 @@ def sqs_batch_processor(

"""
config = config or Config()
processor = PartialSQSProcessor(config=config, suppress_exception=suppress_exception)
session = boto3_session or boto3.session.Session()

processor = PartialSQSProcessor(config=config, suppress_exception=suppress_exception, boto3_session=session)

records = event["Records"]

Expand Down