From 7bbb8155d4d5a674fc6e39b9cf0eb215b120743e Mon Sep 17 00:00:00 2001 From: evbrew Date: Fri, 28 Aug 2020 14:21:37 -0700 Subject: [PATCH] Add sendMessage function for SQS service --- services/sqs.cfc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/services/sqs.cfc b/services/sqs.cfc index 45df293..84b8df2 100644 --- a/services/sqs.cfc +++ b/services/sqs.cfc @@ -25,6 +25,28 @@ component { } return apiResponse; } + + /** + * Sends a message + * @queueName the name of the queue to send to (e.g. "123456789/my-sqs-queue"). + * @message the message to post, text format. + */ + public any function sendMessage( + required string queueName, + required string message + ) { + var requestSettings = api.resolveRequestSettings( argumentCollection = arguments ); + var apiResponse = apiCall( + requestSettings, + 'GET', + '/' & queueName, + { 'Action': 'SendMessage', 'MessageBody': message} + ); + if ( apiResponse.statusCode == 200 ) { + apiResponse[ 'data' ] = utils.parseXmlDocument( apiResponse.rawData ); + } + return apiResponse; + } // private