diff --git a/aws_lambda_powertools/utilities/data_classes/active_mq_event.py b/aws_lambda_powertools/utilities/data_classes/active_mq_event.py index 09981bdcdd2..94929a79572 100644 --- a/aws_lambda_powertools/utilities/data_classes/active_mq_event.py +++ b/aws_lambda_powertools/utilities/data_classes/active_mq_event.py @@ -55,6 +55,11 @@ def broker_out_time(self) -> int: """Time stamp (in milliseconds) for when the message left the broker.""" return self["brokerOutTime"] + @property + def properties(self) -> dict: + """Custom properties""" + return self["properties"] + @property def destination_physicalname(self) -> str: return self["destination"]["physicalname"] diff --git a/tests/events/activeMQEvent.json b/tests/events/activeMQEvent.json index 290ada184c9..57417cfd229 100644 --- a/tests/events/activeMQEvent.json +++ b/tests/events/activeMQEvent.json @@ -13,7 +13,10 @@ }, "timestamp": 1598827811958, "brokerInTime": 1598827811958, - "brokerOutTime": 1598827811959 + "brokerOutTime": 1598827811959, + "properties": { + "testKey": "testValue" + } }, { "messageID": "ID:b-9bcfa592-423a-4942-879d-eb284b418fc8-1.mq.us-west-2.amazonaws.com-37557-1234520418293-4:1:1:1:1", @@ -26,7 +29,11 @@ }, "timestamp": 1598827811958, "brokerInTime": 1598827811958, - "brokerOutTime": 1598827811959 + "brokerOutTime": 1598827811959, + "properties": { + "testKey": "testValue" + } + }, { "messageID": "ID:b-9bcfa592-423a-4942-879d-eb284b418fc8-1.mq.us-west-2.amazonaws.com-37557-1234520418293-4:1:1:1:1", @@ -39,7 +46,10 @@ }, "timestamp": 1598827811958, "brokerInTime": 1598827811958, - "brokerOutTime": 1598827811959 + "brokerOutTime": 1598827811959, + "properties": { + "testKey": "testValue" + } } ] } diff --git a/tests/functional/data_classes/test_amazon_mq.py b/tests/functional/data_classes/test_amazon_mq.py index bca2c6e8a8a..0a1467845ea 100644 --- a/tests/functional/data_classes/test_amazon_mq.py +++ b/tests/functional/data_classes/test_amazon_mq.py @@ -30,6 +30,7 @@ def test_active_mq_event(): assert message.timestamp is not None assert message.broker_in_time is not None assert message.broker_out_time is not None + assert message.properties["testKey"] == "testValue" assert message.destination_physicalname is not None assert message.delivery_mode is None assert message.correlation_id is None