@@ -58,6 +58,7 @@ Same example as above, but using the `event_source` decorator
58
58
59
59
Event Source | Data_class
60
60
------------------------------------------------- | ---------------------------------------------------------------------------------
61
+ [ Active MQ] ( #active-mq ) | ` ActiveMQEvent `
61
62
[ API Gateway Authorizer] ( #api-gateway-authorizer ) | ` APIGatewayAuthorizerRequestEvent `
62
63
[ API Gateway Authorizer V2] ( #api-gateway-authorizer-v2 ) | ` APIGatewayAuthorizerEventV2 `
63
64
[ API Gateway Proxy] ( #api-gateway-proxy ) | ` APIGatewayProxyEvent `
@@ -72,6 +73,7 @@ Event Source | Data_class
72
73
[ DynamoDB streams] ( #dynamodb-streams ) | ` DynamoDBStreamEvent ` , ` DynamoDBRecordEventName `
73
74
[ EventBridge] ( #eventbridge ) | ` EventBridgeEvent `
74
75
[ Kinesis Data Stream] ( #kinesis-streams ) | ` KinesisStreamEvent `
76
+ [ Rabbit MQ] ( #rabbit-mq ) | ` RabbitMQEvent `
75
77
[ S3] ( #s3 ) | ` S3Event `
76
78
[ S3 Object Lambda] ( #s3-object-lambda ) | ` S3ObjectLambdaEvent `
77
79
[ SES] ( #ses ) | ` SESEvent `
@@ -82,6 +84,31 @@ Event Source | Data_class
82
84
The examples provided below are far from exhaustive - the data classes themselves are designed to provide a form of
83
85
documentation inherently (via autocompletion, types and docstrings).
84
86
87
+ ### Active MQ
88
+
89
+ It is used for [ Active MQ payloads] ( https://docs.aws.amazon.com/lambda/latest/dg/with-mq.html ) {target="_ blank"}, also see
90
+ the [ AWS blog post] ( https://aws.amazon.com/blogs/compute/using-amazon-mq-as-an-event-source-for-aws-lambda/ ) {target="_ blank"}
91
+ for more details.
92
+
93
+ === "app.py"
94
+
95
+ ```python
96
+ from typing import Dict
97
+
98
+ from aws_lambda_powertools import Logger
99
+ from aws_lambda_powertools.utilities.data_classes import event_source
100
+ from aws_lambda_powertools.utilities.data_classes.active_mq_event import ActiveMQEvent
101
+
102
+ logger = Logger()
103
+
104
+ @event_source(data_class=ActiveMQEvent)
105
+ def lambda_handle(event: ActiveMQEvent, context):
106
+ for message in event.messages:
107
+ logger.debug(f"MessageID: {message.message_id}")
108
+ data: Dict = message.json_data
109
+ logger.debug("Process json in base64 encoded data str", data)
110
+ ```
111
+
85
112
### API Gateway Authorizer
86
113
87
114
> New in 1.20.0
@@ -810,6 +837,33 @@ or plain text, depending on the original payload.
810
837
do_something_with(data)
811
838
```
812
839
840
+ ### Rabbit MQ
841
+
842
+ It is used for [ Rabbit MQ payloads] ( https://docs.aws.amazon.com/lambda/latest/dg/with-mq.html ) {target="_ blank"}, also see
843
+ the [ blog post] ( https://aws.amazon.com/blogs/compute/using-amazon-mq-for-rabbitmq-as-an-event-source-for-lambda/ ) {target="_ blank"}
844
+ for more details.
845
+
846
+ === "app.py"
847
+
848
+ ```python
849
+ from typing import Dict
850
+
851
+ from aws_lambda_powertools import Logger
852
+ from aws_lambda_powertools.utilities.data_classes import event_source
853
+ from aws_lambda_powertools.utilities.data_classes.rabbit_mq_event import RabbitMQEvent
854
+
855
+ logger = Logger()
856
+
857
+ @event_source(data_class=RabbitMQEvent)
858
+ def lambda_handle(event: RabbitMQEvent, context):
859
+ for queue_name, messages in event.rmq_messages_by_queue.items():
860
+ logger.debug(f"Messages for queue: {queue_name}")
861
+ for message in messages:
862
+ logger.debug(f"MessageID: {message.basic_properties.message_id}")
863
+ data: Dict = message.json_data
864
+ logger.debug("Process json in base64 encoded data str", data)
865
+ ```
866
+
813
867
### S3
814
868
815
869
=== "app.py"
0 commit comments