Skip to content

Commit

Permalink
feat: extract messageId from receieveMessage SDK operation (#97)
Browse files Browse the repository at this point in the history
Co-authored-by: CircleCI <no-reply@build.com>
  • Loading branch information
saartochner-lumigo and CircleCI authored Oct 18, 2022
1 parent 7bc7efb commit 070a982
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/parsers/aws.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ describe('aws parser', () => {
'<?xml version="1.0"?><SendMessageResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><SendMessageResult><MessageId>85dc3997-b060-47bc-9d89-c754d7260dbd</MessageId><MD5OfMessageBody>c5cb6abef11b88049177473a73ed662f</MD5OfMessageBody></SendMessageResult><ResponseMetadata><RequestId>b6b5a045-23c6-5e3a-a54f-f7dd99f7b379</RequestId></ResponseMetadata></SendMessageResponse>',
// send message batch (with one record)
'<?xml version="1.0"?><SendMessageBatchResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><SendMessageBatchResult><SendMessageBatchResultEntry><Id>11dd068c-fb3c-43e8-a2ae-1a914780735f</Id><MessageId>85dc3997-b060-47bc-9d89-c754d7260dbd</MessageId><MD5OfMessageBody>c5cb6abef11b88049177473a73ed662f</MD5OfMessageBody></SendMessageBatchResultEntry></SendMessageBatchResult><ResponseMetadata><RequestId>b6b5a045-23c6-5e3a-a54f-f7dd99f7b379</RequestId></ResponseMetadata></SendMessageBatchResponse>',
// receive message single
'<?xml version=\\"1.0\\"?><ReceiveMessageResponse xmlns=\\"http://queue.amazonaws.com/doc/2012-11-05/\\"><ReceiveMessageResult><Message><MessageId>85dc3997-b060-47bc-9d89-c754d7260dbd</MessageId><ReceiptHandle>abcabcabc</ReceiptHandle><MD5OfBody>aaaaaaaaaaaaaaaaaaa</MD5OfBody><Body>myMessage</Body></Message></ReceiveMessageResult><ResponseMetadata><RequestId>abcdef-abcdef-abcdef-abcdef-abcdef</RequestId></ResponseMetadata></ReceiveMessageResponse>',
// receive message batch
'<?xml version=\\"1.0\\"?><ReceiveMessageResponse xmlns=\\"http://queue.amazonaws.com/doc/2012-11-05/\\"><ReceiveMessageResult><Message><MessageId>85dc3997-b060-47bc-9d89-c754d7260dbd</MessageId><ReceiptHandle>abcabcabc</ReceiptHandle><MD5OfBody>aaaaaaaaaaaaaaaaaaa</MD5OfBody><Body>Message 9</Body></Message><Message><MessageId>22222222-b060-47bc-9d89-c754d7260dbd</MessageId><ReceiptHandle>abcabcabc</ReceiptHandle><MD5OfBody>aaaa</MD5OfBody><Body>Message 14</Body></Message><Message><MessageId>33333333-b060-47bc-9d89-c754d7260dbd</MessageId><ReceiptHandle>abcabcabc</ReceiptHandle><MD5OfBody>aaaaa</MD5OfBody><Body>Message 35</Body></Message></ReceiveMessageResult><ResponseMetadata><RequestId>abcdef-abcdef-abcdef-abcdef-abcdef</RequestId></ResponseMetadata></ReceiveMessageResponse>',
].map((responseDataBody) =>
test('sqsParser -> happy flow', () => {
const queueUrl = 'https://sqs.us-west-2.amazonaws.com/33/random-queue-test';
Expand Down
10 changes: 10 additions & 0 deletions src/parsers/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ export const sqsParser = (requestData, responseData) => {
'MessageId',
],
undefined
) ||
safeGet(
parsedResBody,
['ReceiveMessageResponse', 'ReceiveMessageResult', 'Message', 'MessageId'],
undefined
) ||
safeGet(
parsedResBody,
['ReceiveMessageResponse', 'ReceiveMessageResult', 'Message', 0, 'MessageId'],
undefined
);
return awsServiceData;
};
Expand Down

0 comments on commit 070a982

Please sign in to comment.