lib/pheme/queue_poller.rb in pheme-4.0.0 vs lib/pheme/queue_poller.rb in pheme-4.0.1

- old
+ new

@@ -108,12 +108,13 @@ message_body = JSON.parse(queue_message.body) { timestamp: message_body['Timestamp'], topic_arn: message_body['TopicArn'] } end def parse_message_attributes(queue_message) + message_body = JSON.parse(queue_message.body) message_attributes = {} - queue_message.message_attributes&.each do |key, value| + message_body['MessageAttributes']&.each do |key, value| message_attributes[key.to_sym] = coerce_message_attribute(value) end message_attributes end @@ -147,21 +148,21 @@ end private def coerce_message_attribute(value) - case value['data_type'] + case value['Type'] when 'String' - value['string_value'] + value['Value'] when 'Number' - JSON.parse(value['string_value']) + JSON.parse(value['Value']) when 'String.Array' - JSON.parse(value['string_value']) + JSON.parse(value['Value']) when 'Binary' - value['binary_value'] + value['Value'] else Pheme.logger.info("Unsupported custom data type") - value["binary_value"] || value["string_value"] + value["Value"] end end def with_optional_connection_pool_block if connection_pool_block