Skip to content
akshat edited this page Nov 7, 2022 · 7 revisions

NOTE: Minimum version is 6.2.0, because multiple commands are deprecated post that.

Redis Message Broker supports all the features of Goose.

Redis connection opts need :url & :pool-opts.

URL

Reference for URL Syntax

Pool Opts

Pool Opts can be :none, a map of Jedis pool configs, or satisfy IConnectionPool protocol of Carmine

Usage

(ns redis-broker
  (:require
    [goose.brokers.redis.broker :as redis]
    [goose.client :as c]
    [goose.worker :as w]))

(let [url "redis://username:password@my-redis.host:6379"
      pool-opts {:max-total-per-key 10
                 :max-idle-per-key  10
                 :min-idle-per-key  2}
      conn-opts {:url url :pool-opts pool-opts}
      redis-producer (redis/new-producer conn-opts)
      
      scheduler-polling-interval-sec 15
      redis-consumer (redis/new-consumer conn-opts scheduler-polling-interval-sec)

      ;; Use client/worker opts for enqueuing/dequeuing jobs.
      client-opts (assoc c/default-opts :broker redis-producer)
      worker-opts (assoc w/default-opts :broker redis-consumer)])

Previous: RabbitMQ        Next: Guide to Message Broker Integration

Clone this wiki locally