Liking cljdoc? Tell your friends :D

sqs-utils.core


handle-queueclj

(handle-queue sqs-config queue-url handler-fn)
(handle-queue sqs-config
              queue-url
              handler-fn
              {:keys [num-handler-threads auto-delete visibility-timeout
                      maximum-messages]
               :or {num-handler-threads 4
                    auto-delete true
                    visibility-timeout 60
                    maximum-messages 10}
               :as opts})

Set up a loop that listens to a queue and process incoming messages.

Arguments: sqs-config - A map of the following keys, used for interacting with SQS: access-key - AWS access key ID secret-key - AWS secret access key endpoint - SQS queue endpoint - usually an HTTPS based URL region - AWS region queue-url - URL of the queue handler-fn - a function which will be passed the incoming message. If auto-delete is false, a second argument will be passed a done function to call when finished processing. opts - an optional map containing the following keys: num-handler-threads - how many threads to run (defaults: 4)

auto-delete         - boolean, if true, immediately delete the message,
                      if false, forward a `done` function and leave the
                      message intact. (defaults: true)

visibility-timeout  - how long (in seconds) a message can go unacknowledged
                      before delivery is retried. (defaults: 60)

maximum-messages    - the maximum number of messages to be delivered as
                      a result of a single poll of SQS.

See http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html for more information about visibility timeout.

Returns: a kill function - call the function to terminate the loop.

Set up a loop that listens to a queue and process incoming messages.

 Arguments:
 sqs-config  - A map of the following keys, used for interacting with SQS:
    access-key - AWS access key ID
    secret-key - AWS secret access key
    endpoint   - SQS queue endpoint - usually an HTTPS based URL
    region     - AWS region
 queue-url  - URL of the queue
 handler-fn - a function which will be passed the incoming message. If
              auto-delete is false, a second argument will be passed a `done`
              function to call when finished processing.
 opts       - an optional map containing the following keys:
    num-handler-threads - how many threads to run (defaults: 4)

    auto-delete         - boolean, if true, immediately delete the message,
                          if false, forward a `done` function and leave the
                          message intact. (defaults: true)

    visibility-timeout  - how long (in seconds) a message can go unacknowledged
                          before delivery is retried. (defaults: 60)

    maximum-messages    - the maximum number of messages to be delivered as
                          a result of a single poll of SQS.

See http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
for more information about visibility timeout.

Returns:
a kill function - call the function to terminate the loop.
sourceraw docstring

receive-loop!clj

(receive-loop! sqs-config queue-url out-chan)
(receive-loop! sqs-config
               queue-url
               out-chan
               {:keys [auto-delete visibility-timeout restart-delay-seconds
                       maximum-messages]
                :or {auto-delete true
                     visibility-timeout 60
                     restart-delay-seconds 1
                     maximum-messages 10}
                :as opts})

A background loop to receive SQS messages from a queue indefinitely.

Arguments: sqs-config - A map of the following keys, used for interacting with SQS: access-key - AWS access key ID secret-key - AWS secret access key endpoint - SQS queue endpoint - usually an HTTPS based URL region - AWS region queue-url - URL of the queue out-chan - async channel where messages will be passed into opts - an optional map containing the following keys:

auto-delete           - boolean, if true, immediately delete the message,
                        if false, forward a `done` function and leave the
                        message intact.

visibility-timeout    - how long (in seconds) a message can go unacknowledged
                        before delivery is retried.

restart-delay-seconds - how long (in seconds) to wait before attempting to
                        restart the consumer loop.

maximum-messages      - the maximum number of messages to be delivered as
                        a result of a single poll of SQS.

auto-delete defaults to true, visibility-timeout defaults to 60 seconds.

Returns a kill function - call the function to terminate the loop.

A background loop to receive SQS messages from a queue indefinitely.

 Arguments:
 sqs-config  - A map of the following keys, used for interacting with SQS:
    access-key - AWS access key ID
    secret-key - AWS secret access key
    endpoint   - SQS queue endpoint - usually an HTTPS based URL
    region     - AWS region
 queue-url - URL of the queue
 out-chan  - async channel where messages will be passed into
 opts      - an optional map containing the following keys:

    auto-delete           - boolean, if true, immediately delete the message,
                            if false, forward a `done` function and leave the
                            message intact.

    visibility-timeout    - how long (in seconds) a message can go unacknowledged
                            before delivery is retried.

    restart-delay-seconds - how long (in seconds) to wait before attempting to
                            restart the consumer loop.

    maximum-messages      - the maximum number of messages to be delivered as
                            a result of a single poll of SQS.

auto-delete defaults to true, visibility-timeout defaults to 60 seconds.

Returns a kill function - call the function to terminate the loop.
sourceraw docstring

receive-one!clj

(receive-one! sqs-config queue-url)
source

send-fifo-messageclj

(send-fifo-message sqs-config
                   queue-url
                   payload
                   {message-group-id :message-group-id
                    deduplication-id :deduplication-id
                    format :format
                    :as options
                    :or {format :transit}})

Send a message to a FIFO queue.

Arguments: message-group-id - a tag that specifies the group that this message belongs to. Messages belonging to the same group are guaranteed FIFO

Options: deduplication-id - token used for deduplication of sent messages

Send a message to a FIFO queue.

Arguments:
message-group-id - a tag that specifies the group that this message
                   belongs to. Messages belonging to the same group
                   are guaranteed FIFO

Options:
deduplication-id -  token used for deduplication of sent messages
sourceraw docstring

send-messageclj

(send-message sqs-config queue-url payload)
(send-message sqs-config
              queue-url
              payload
              {:keys [format] :or {format :transit}})

Send a message to a standard queue, by default transit encoded. An optional map may be passed as a 5th argument, containing a :format key which should be set to either :json or :transit.

Send a message to a standard queue, by default transit encoded. An optional map
may be passed as a 5th argument, containing a `:format` key which should be
set to either `:json` or `:transit`.
sourceraw docstring

send-message*clj

(send-message* sqs-config
               queue-url
               payload
               {:keys [message-group-id deduplication-id format]
                :or {format :transit}})

Send a message to a queue.

Send a message to a queue.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close