On this page:
sqs-endpoint
create-queue
delete-queue
list-queues
get-queue-uri
send-message
get-queue-attributes
message
receive-messages
receive-message
delete-message
change-message-visibility

9 SQS (Queues)

 (require (planet gh/aws:1:=5/sqs))

SQS provides distributed queues.

parameter

(sqs-endpoint)  endpoint?

(sqs-endpoint v)  void?
  v : endpoint?
Set the endpoint for the service. Defaults to (endpoint "sqs.us-east-1.amazonaws.com" #f).

procedure

(create-queue name)  string?

  name : string?
Create a queue and return its URI. The URI is used to identify the queue in most of the other procedures.

procedure

(delete-queue queue-uri)  void?

  queue-uri : string?
Delete a queue.

procedure

(list-queues)  (listof string?)

List all the queues associated with the AWS account.

procedure

(get-queue-uri name)  string?

  name : string?
Given the name of a queue, get its URI.

procedure

(send-message queue-uri body [delay-seconds])  void?

  queue-uri : string
  body : string?
  delay-seconds : (or/c #f exact-nonnegative-integer?) = #f
Send a message to a queue. See SQS docs for meaning of delay-seconds, but, if not supplied the delay will default to that of the queue.

procedure

(get-queue-attributes queue-uri)

  (listof (list/c symbol? string?))
  queue-uri : string?
Get all the attributes for a queue. They are returned as a list instead of a struct because the list of attributes may grow in future versions of SQS.

struct

(struct message (body md5 receipt-handle attributes)
  #:extra-constructor-name make-message)
  body : string?
  md5 : string?
  receipt-handle : string?
  attributes : (listof (list/c symbol? string?))

procedure

(receive-messages queue-uri    
  max    
  [visibility-timeout])  (listof message?)
  queue-uri : string?
  max : (and/c exact-integer? (between/c 1 10))
  visibility-timeout : (or/c #f exact-nonnegative-integer?) = #f

procedure

(receive-message queue-uri    
  [visibility-timeout])  (listof message?)
  queue-uri : string?
  visibility-timeout : (or/c #f exact-nonnegative-integer?) = #f

Get one or more messages from the queue.

receive-message is simply sugar for receive-messages with 1 supplied for max.

The receipt-handle field of message is used to identify the message in procedures that operate on a specific message.

Note: The attributes field of message is the same format as get-queue-attributes and for the same reason.

procedure

(delete-message queue-uri receipt-handle)  void?

  queue-uri : string?
  receipt-handle : string?
Delete a message from a queue.

procedure

(change-message-visibility queue-uri    
  receipt-handle    
  timeout)  void?
  queue-uri : string?
  receipt-handle : string?
  timeout : exact-nonnegative-integer?
Change the visibility time of a message already in a queue.