Skip to content

WonderQ API Documentation

Paul Warnick edited this page Aug 24, 2020 · 3 revisions

API documentation for the functions used to create WonderQ

sendMessage(messageBody, callback)

messageBody: Object { message: $ANY }
callback: function
  • We use sendMessage to save a new message into WonderQ
  • messageBody is an object with a single message property of any type
  • We use callback to return a success/error status to our REST API as well as the generated messageID to return to the producer

receiveMessage(callback)

callback: function
  • We use receiveMessage to read a new message from the queue
    • We'll go through the queue in a FIFO order looking for the first message that is currently unlocked and ready for processing
    • Once we've located an item that is ready for processing, we lock that item, generate the receiptHandle start the visibilityTimeout and return the item to the consumer
      • receiptHandle is used to once the consumer has finished processing to track deletion of the current message
      • visibilityTimeout is used to track how long a consumer can hold onto a message to process before it becomes visible to other consumers again
  • callback is used to indicate the status to our REST API as well as the queue message itself

deleteMessage(receiptHandle, callback)

receiptHandle: uuidv4()
callback: function
  • We use deleteMessage to delete a message from WonderQ
    • The receiptHandle passed in should be a uuidv4<String> that is associated with a message in the queue
  • callback returns the status of the call to the REST API