Liking cljdoc? Tell your friends :D

clj-sqs-extended.core


create-fifo-queue!clj

(create-fifo-queue! sqs-client queue-name)
(create-fifo-queue! sqs-client
                    queue-name
                    {:keys [visibility-timeout-in-seconds kms-master-key-id
                            kms-data-key-reuse-period]
                     :as opts})
source

create-standard-queue!clj

(create-standard-queue! sqs-client queue-name)
(create-standard-queue! sqs-client
                        queue-name
                        {:keys [visibility-timeout-in-seconds kms-master-key-id
                                kms-data-key-reuse-period]
                         :as opts})
source

delete-message!clj

(delete-message! sqs-client queue-url message)
source

delete-queue!clj

(delete-queue! sqs-client queue-url)
source

handle-queueclj

(handle-queue {:keys [access-key secret-key s3-endpoint s3-bucket-name
                      sqs-endpoint region]
               :as sqs-ext-config}
              {:keys [queue-url number-of-handler-threads restart-limit
                      restart-delay-seconds auto-delete]
               :or {number-of-handler-threads 4
                    restart-limit 6
                    restart-delay-seconds 10
                    auto-delete true}}
              handler-fn)

Setup a loop that listens to a queue and processes all incoming messages.

Arguments: sqs-ext-config - A map of the following optional keys used for accessing AWS services: access-key - AWS access key ID secret-key - AWS secret access key s3-endpoint - AWS S3 endpoint (protocol://service-code.region-code.amazonaws.com) s3-bucket-name - AWS S3 bucket to use to store messages larger than 256kb (optional) sqs-endpoint - AWS SQS endpoint (protocol://service-code.region-code.amazonaws.com) region - AWS region

handler-opts - A map for the queue handling settings: queue-url - A string containing the unique URL of the queue to handle (required) number-of-handler-threads - Number of how many threads to run for handling message receival (optional, default: 4) restart-limit - If a potentially non-fatal error occurs while handling the queue, it will try this many times to restart in order to hopefully recover from the occured error (optional, default: 6) restart-delay-seconds - If the loop restarts, restart will be delayed by this many seconds (optional, default: 10) auto-delete - A boolean where true: will immediately delete the message false: will provide a done-fn key inside the returned messages and the message will be left untouched by this API (optional, defaults: true)

handler-fn - A function to which new incoming messages will be passed to (required)

           NOTE: If auto-delete above is set to false, a `done-fn` function will be passed as
                 second argument which should be called to delete the message when processing
                 has been finished.

Returns: A stop function - Call this function to terminate the loop and receive a map of final information about the finished handling process (hopefully handy for debugging). That map includes:

                {:iteration                  The total count of iterations the loop was executed
                 :restart-count 0            Number of times the loop was restarted
                 :started-at    (t/now)      A tick instant timestamp when the loop was started
                 :last-iteration-started-at  A tick instant timestamp when the loop began last
                 :stopped-at                 A tick instant timestamp when the loop was stopped
                 :last-loop-duration-in-seconds} Last loop's running time in seconds
Setup a loop that listens to a queue and processes all incoming messages.

Arguments:
  sqs-ext-config - A map of the following optional keys used for accessing AWS services:
    access-key     - AWS access key ID
    secret-key     - AWS secret access key
    s3-endpoint    - AWS S3 endpoint (protocol://service-code.region-code.amazonaws.com)
    s3-bucket-name - AWS S3 bucket to use to store messages larger than 256kb (optional)
    sqs-endpoint   - AWS SQS endpoint (protocol://service-code.region-code.amazonaws.com)
    region         - AWS region

  handler-opts - A map for the queue handling settings:
    queue-url                 - A string containing the unique URL of the queue to handle (required)
    number-of-handler-threads - Number of how many threads to run for handling message receival
                                (optional, default: 4)
    restart-limit             - If a potentially non-fatal error occurs while handling the queue,
                                it will try this many times to restart in order to hopefully recover
                                from the occured error (optional, default: 6)
    restart-delay-seconds     - If the loop restarts, restart will be delayed by this many seconds
                                (optional, default: 10)
    auto-delete               - A boolean where
                                true: will immediately delete the message
                                false: will provide a `done-fn` key inside the returned messages and
                                       the message will be left untouched by this API
                                (optional, defaults: true)

  handler-fn - A function to which new incoming messages will be passed to (required)

               NOTE: If auto-delete above is set to false, a `done-fn` function will be passed as
                     second argument which should be called to delete the message when processing
                     has been finished.

Returns:
  A stop function - Call this function to terminate the loop and receive a map of final
                    information about the finished handling process (hopefully handy for
                    debugging). That map includes:

                    {:iteration                  The total count of iterations the loop was executed
                     :restart-count 0            Number of times the loop was restarted
                     :started-at    (t/now)      A tick instant timestamp when the loop was started
                     :last-iteration-started-at  A tick instant timestamp when the loop began last
                     :stopped-at                 A tick instant timestamp when the loop was stopped
                     :last-loop-duration-in-seconds} Last loop's running time in seconds
sourceraw docstring

purge-queue!clj

(purge-queue! sqs-client queue-url)
source

receive-loopclj

(receive-loop sqs-ext-client
              queue-url
              initial-receiving-chan
              create-receiving-chan-fn
              out-chan)
(receive-loop sqs-ext-client
              queue-url
              initial-receiving-chan
              create-receiving-chan-fn
              out-chan
              {:keys [auto-delete restart-delay-seconds restart-limit]
               :as receive-opts})
source

send-fifo-messageclj

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

Send a message to a FIFO queue.

Argments: sqs-client - The extended sqs-client via which the request shall be sent queue-url - the queue's URL message - The actual message/data to be sent message-group-id - A value that will be parsed as string to specify the group that this message belongs to. Messages belonging to the same group are guaranteed FIFO

Options: format - The format (currently :json or :transit) to serialize the outgoing message with (default: :transit) deduplication-id - A string used for deduplication of sent messages

Send a message to a FIFO queue.

Argments:
  sqs-client       - The extended sqs-client via which the request shall be sent
  queue-url        - the queue's URL
  message          - The actual message/data to be sent
  message-group-id - A value that will be parsed as string to specify the
                     group that this message belongs to. Messages belonging
                     to the same group are guaranteed FIFO

Options:
  format           - The format (currently :json or :transit) to serialize the outgoing
                     message with (default: :transit)
  deduplication-id - A string used for deduplication of sent messages
sourceraw docstring

send-messageclj

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

Send a message to a standard queue.

Argments: sqs-client - The extended sqs-client via which the request shall be sent queue-url - the queue's URL message - The actual message/data to be sent

Options: format - The format (currently :json or :transit) to serialize the outgoing message with (default: :transit)

Send a message to a standard queue.

Argments:
  sqs-client - The extended sqs-client via which the request shall be sent
  queue-url  - the queue's URL
  message    - The actual message/data to be sent

Options:
  format     - The format (currently :json or :transit) to serialize the outgoing
               message with (default: :transit)
sourceraw docstring

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

× close