Skip to content

Commit

Permalink
Merge pull request #35 from evbrew/evbrew-sqs-sendmessage
Browse files Browse the repository at this point in the history
Add sendMessage function for SQS service
  • Loading branch information
jcberquist authored Aug 29, 2020
2 parents 605be98 + 7bbb815 commit 2d4629e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions services/sqs.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2d4629e

Please sign in to comment.