The SQS event will automatically handle many common things done when eventing off an SQS stream. Developers
then have the ability to further extend that functionality with custom middleware. Below is a full list of all the
configurations available and examples of their use.
Examples
Don't like reading documentation? Then look at
our examples, which can be deployed in 1
command into your AWS account!
fromacai.sqs.requirementsimportrequirementsfromacai_aws.commonimportlogger@requirements(before=log_something,data_class=SomeClass,raise_body_error=True,schema='service/openapi.yml',required_body='v1-sqs-body',# or jsonschema dictafter=alert_something,)defhandle(event):forrecordinevent.records:logger.log(log=record)# example data classclassSomeClass:def__init__(self,record):fork,vinrecord.body.items():setattr(self,k,v)# example before functiondeflog_something(records,requirements):if'something'inrequirements:logger.log(log=records)# example after functiondefalert_something(records,result,requirements):if'something'inresultand'alert'inrequirements:logger.log(log=records)