OpenBD Wiki

From OpenBD
Jump to: navigation, search

SqsReceiveMessage()

This function gets the latest messages from a queue. It can return up to 10 messages at once.

Amazon SQS

Contents

Parameters

sqsReceiveMessage( name, queueUrl, [ numMessages, VisibilityTimeOut ] )

  • name: name for this datasource, previously registered using AmazonSQS()
  • queueUrl: the url of the queue you wish to access
  • numMessages: the number of messages to try to retrieve (maximum 10, default 1) (optional)
  • VisibilityTimeOut: the amount of seconds a message's invisibility will be set to (optional)

Returns

This function will return an array of structs. Each struct contains:

  • MessageId
  • ReceiptHandle
  • MD5OfBody
  • Body

Example

<cfset AmazonSQS("testamz", "1WHJCG48Y89P4582", "bC6kfiW715mIenvtr537DcHndYmQwVf5l")>
<cfset message = sqsReceiveMessage( "testamz", queueUrl )>
<cfif ArrayLen(message) neq 0>
  <cfset sqsDeleteMessage("testamz", queueUrl, message[1]["ReceiptHandle"] )>
</cfif>

Notes

For more information on Message visibility see Message Visibility

Engine Compatibility

  • OpenBD
  • BlueDragon

Personal tools