Liking cljdoc? Tell your friends :D

common-pg-queue.consumer


new-queue-worker-managerclj

(new-queue-worker-manager workers-config)

Creates a manager that starts one proletarian queue worker per entry in workers-config.

workers-config: a list of maps, each with:

  • :queue - keyword, queue name (becomes :proletarian/queue)
  • :handler - fn/multimethod (job-type payload), typically the handle-job! multimethod from proletarian.job defined in the project that consumes this lib
  • :opts - (optional) map passed straight through to proletarian's create-queue-worker (:retry-strategy-fn, :failed-job-fn, :proletarian/worker-threads, etc.)

Depends on the :database component (component/using [:database]) - reuses the same datasource/pool as the rest of the app, no connection of its own.

Example: (component/using (consumer/new-queue-worker-manager [{:queue :emails :handler handlers/handle-job!} {:queue :thumbnails :handler handlers/handle-job! :opts {:proletarian/worker-threads 4}}]) [:database])

Creates a manager that starts one proletarian queue worker per entry in
workers-config.

workers-config: a list of maps, each with:
- :queue   - keyword, queue name (becomes :proletarian/queue)
- :handler - fn/multimethod (job-type payload), typically the
             handle-job! multimethod from proletarian.job defined in
             the project that consumes this lib
- :opts    - (optional) map passed straight through to proletarian's
             create-queue-worker (:retry-strategy-fn, :failed-job-fn,
             :proletarian/worker-threads, etc.)

Depends on the :database component (component/using [:database]) -
reuses the same datasource/pool as the rest of the app, no connection
of its own.

Example:
(component/using
 (consumer/new-queue-worker-manager
  [{:queue :emails :handler handlers/handle-job!}
   {:queue :thumbnails
    :handler handlers/handle-job!
    :opts {:proletarian/worker-threads 4}}])
 [:database])
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close