From 4e8e7f725787ef6818f09a0b9442c1421286479c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rosel=20Sosa=20Gonz=C3=A1lez?= Date: Mon, 22 Jul 2024 12:31:18 -0400 Subject: [PATCH] Extract only the supported message attributes for AWS SQS (#770) --- bin/cli/sqs.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/cli/sqs.rb b/bin/cli/sqs.rb index f6c1ab2f..0c257a6e 100644 --- a/bin/cli/sqs.rb +++ b/bin/cli/sqs.rb @@ -14,10 +14,17 @@ class SQS < Base def normalize_dump_message(message) # symbolize_keys is needed for keeping it compatible with `requeue` attributes = message[:attributes].symbolize_keys + + # See https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_MessageAttributeValue.html + # The `string_list_values` and `binary_list_values` are not implemented. Reserved for future use. + message_attributes = message[:message_attributes].each_with_object({}) do |(k, v), result| + result[k] = v.slice(:data_type, :string_value, :binary_value) + end + { id: message[:message_id], message_body: message[:body], - message_attributes: message[:message_attributes], + message_attributes: message_attributes, message_deduplication_id: attributes[:MessageDeduplicationId], message_group_id: attributes[:MessageGroupId] }