Skip to content

Getting Started

akshat edited this page Jul 28, 2022 · 11 revisions

System Requirements

  • Clojure >= 1.11.0
  • Redis >= 2.0.0

Adding Goose as a dependency

Clojure CLI/deps.edn

com.nilenso/goose {:mvn/version "0.1"}

Leiningen/Boot

[com.nilenso/goose "0.1"]

Enqueuing a job

(ns my-app
  (:require [goose.client :as c]))

; Supply a fully-qualified function symbol for enqueuing.
; Args to perform-async are variadic.
(defn my-fn
  [arg1 arg2]
  (println "my-fn called with" arg1 arg2))

(c/perform-async c/default-opts `my-fn "foo" :bar)

Dequeuing a job

(ns my-worker
  (:require [goose.worker :as w]))

; my-app namespace should be resolvable.
(let [worker (w/start w/default-opts)]
  ; ... listen for SIGINT or SIGTERM ...
  (w/stop worker))

Advanced Steps

Refer to relevant wikis for Broker Config, Worker Config, Scheduling a Job, Error Handling & Retries, Middleware linked on the home page.

Goose Jobs can be managed using API as well.

Clone this wiki locally