Map of sample configs for consuming jobs.
:broker
: Message broker that transfers message from Producer to Consumer.
Given value must implement goose.broker/Broker
protocol.
Message Broker wiki
:threads
: Count of thread-pool-size for executing jobs.
:queue
: Queue from which to consume jobs for execution.
:graceful-shutdown-sec
: Waiting time for in-progress jobs to complete during shutdown.
:middlewares
: Chain of function/s to run 'around' execution of a Job.
Middlewares wiki
:error-service-config
: Config for error service like Honeybadger, Sentry, etc.
Error Handling & Retries wiki
:metrics-plugin
: Publish Goose metrics to respective backend.
Example : goose.metrics.statsd/new
.
Given value must implement goose.metrics/Metrics
protocol.
If unset or set to nil
, does not record metrics.
Map of sample configs for consuming jobs. #### Mandatory Keys `:broker` : Message broker that transfers message from Producer to Consumer.\ Given value must implement [[goose.broker/Broker]] protocol.\ [Message Broker wiki](https://github.com/nilenso/goose/wiki/Message-Brokers) `:threads` : Count of thread-pool-size for executing jobs. `:queue` : Queue from which to consume jobs for execution. `:graceful-shutdown-sec` : Waiting time for in-progress jobs to complete during shutdown. #### Optional Keys `:middlewares` : Chain of function/s to run 'around' execution of a Job.\ [Middlewares wiki](https://github.com/nilenso/goose/wiki/Middlewares) `:error-service-config` : Config for error service like Honeybadger, Sentry, etc.\ [Error Handling & Retries wiki](https://github.com/nilenso/goose/wiki/Error-Handling-&-Retries) `:metrics-plugin` : Publish Goose metrics to respective backend.\ Example : [[goose.metrics.statsd/new]].\ Given value must implement [[goose.metrics/Metrics]] protocol. If unset or set to `nil`, does not record metrics.
Gracefully shuts down a worker.
Gracefully shuts down a worker.
(stop this)
Stops a worker process in following steps:
Stops a worker process in following steps: - Signal worker thread-pool to shutdown - Await for graceful-shutdown seconds for in-progress jobs to complete - Forcibly shutdown worker thread-pool
(start {:keys [broker] :as opts})
Starts a worker process that does multiple things including, but not limited to:
opts
: Map of :threads
, :queue
, :graceful-shutdown-sec
,
:metrics-plugin
, :middleware
& :error-service-config
.
Example : default-opts
(let [worker (start worker-opts)]
;; When shutting down worker...
(stop worker))
Starts a worker process that does multiple things including, but not limited to: - Consuming & execution of jobs from given queue - Enqueuing scheduled jobs due for execution - Retry failed jobs & mark them as dead when retries are exhausted - Send metrics around Job execution & state of message broker ### Args `opts` : Map of `:threads`, `:queue`, `:graceful-shutdown-sec`, `:metrics-plugin`, `:middleware` & `:error-service-config`.\ Example : [[default-opts]] ### Usage ```Clojure (let [worker (start worker-opts)] ;; When shutting down worker... (stop worker)) ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close