(add-consumer-atom atom name {:keys [id function sync] :as handler})
adds a consumer to the queue
adds a consumer to the queue
(add-exchange-atom atom name opts)
adds a queue to the atom
(-> (atom {}) (add-exchange-atom "ex1" {}) (add-exchange-atom "ex2" {}) ((comp sort keys :exchanges deref))) => ["ex1" "ex2"]
adds a queue to the atom (-> (atom {}) (add-exchange-atom "ex1" {}) (add-exchange-atom "ex2" {}) ((comp sort keys :exchanges deref))) => ["ex1" "ex2"]
(add-in-atom atom keyword name opts defaults)
helper for adding queues and exchanges
helper for adding queues and exchanges
(add-queue-atom atom name opts)
adds a queue to the atom
(-> (atom {}) (add-queue-atom "q3" {}) (add-queue-atom "q2" {}) ((comp sort keys :queues deref))) => ["q2" "q3"]
adds a queue to the atom (-> (atom {}) (add-queue-atom "q3" {}) (add-queue-atom "q2" {}) ((comp sort keys :queues deref))) => ["q2" "q3"]
(bind-exchange-atom atom source dest opts)
binds a queue to the exchange
(-> (atom {}) (common/install-routing routes) (add-exchange-atom "ex3" {}) (bind-exchange-atom "ex1" "ex3" {}) (list-bindings-atom)) => (contains-in {"ex1" {:exchanges {"ex2" [map?] "ex3" [map?]} :queues {"q1" [map?]}} "ex2" {:queues {"q2" [map?]}}})
binds a queue to the exchange (-> (atom {}) (common/install-routing routes) (add-exchange-atom "ex3" {}) (bind-exchange-atom "ex1" "ex3" {}) (list-bindings-atom)) => (contains-in {"ex1" {:exchanges {"ex2" [map?] "ex3" [map?]} :queues {"q1" [map?]}} "ex2" {:queues {"q2" [map?]}}})
(bind-in-atom atom [source-key dest-key bind-type] source dest opts)
helper function for binding to queues and exchanges
helper function for binding to queues and exchanges
(bind-queue-atom atom source dest opts)
binds an exchange to a queue
(-> (atom {}) (common/install-routing routes) (add-queue-atom "q3" {}) (bind-queue-atom "ex1" "q3" {}) (list-bindings-atom)) => (contains-in {"ex1" {:exchanges {"ex2" [map?]} :queues {"q1" [map?] "q3" [map?]}} "ex2" {:queues {"q2" [map?]}}})
binds an exchange to a queue (-> (atom {}) (common/install-routing routes) (add-queue-atom "q3" {}) (bind-queue-atom "ex1" "q3" {}) (list-bindings-atom)) => (contains-in {"ex1" {:exchanges {"ex2" [map?]} :queues {"q1" [map?] "q3" [map?]}} "ex2" {:queues {"q2" [map?]}}})
(delete-consumer-atom atom name id)
deletes a consumer to the queue
deletes a consumer to the queue
(delete-in-atom atom keyword name)
returns current list of queues (-> (atom {}) (add-exchange-atom "ex1" {}) (add-exchange-atom "ex2" {}) (delete-in-atom :exchanges "ex1") (list-in-atom :exchanges)) => {"ex2" {:type "topic" :internal false :auto-delete false :durable true}}
returns current list of queues (-> (atom {}) (add-exchange-atom "ex1" {}) (add-exchange-atom "ex2" {}) (delete-in-atom :exchanges "ex1") (list-in-atom :exchanges)) => {"ex2" {:type "topic" :internal false :auto-delete false :durable true}}
(list-bindings-atom atom)
returns current list of exchanges
(-> (atom {}) (common/install-routing routes) (list-bindings-atom)) => (contains-in {"ex1" {:exchanges {"ex2" [map?]} :queues {"q1" [map?]}} "ex2" {:queues {"q2" [map?]}}})
returns current list of exchanges (-> (atom {}) (common/install-routing routes) (list-bindings-atom)) => (contains-in {"ex1" {:exchanges {"ex2" [map?]} :queues {"q1" [map?]}} "ex2" {:queues {"q2" [map?]}}})
(list-consumers-atom atom)
lists all connected consumers
(-> (atom {}) (common/install-routing routes) (add-consumer-atom "q2" {:id :bar :sync true :function prn}) (list-consumers-atom)) => (contains-in {"q1" {} "q2" {:bar {:id :bar, :sync true, :function fn?}}})
lists all connected consumers (-> (atom {}) (common/install-routing routes) (add-consumer-atom "q2" {:id :bar :sync true :function prn}) (list-consumers-atom)) => (contains-in {"q1" {} "q2" {:bar {:id :bar, :sync true, :function fn?}}})
(list-in-atom atom keyword)
returns current list of queues (-> (atom {}) (add-queue-atom "q3" {}) (list-in-atom :queues)) => {"q3" {:exclusive false :auto-delete false :durable false}}
returns current list of queues (-> (atom {}) (add-queue-atom "q3" {}) (list-in-atom :queues)) => {"q3" {:exclusive false :auto-delete false :durable false}}
(match-pattern pattern input)
creates a re-pattern for the rabbitmq regex string
(match-pattern "*" "hello") => true
(match-pattern ".*." ".hello.") => true
creates a re-pattern for the rabbitmq regex string (match-pattern "*" "hello") => true (match-pattern ".*." ".hello.") => true
(publish-atom atom exchange body {:keys [key headers] :as opts})
publishes a message to the exchange
(def p (promise))
(-> (atom {}) (common/install-routing routes) (add-consumer-atom "q1" {:id :bar :sync true :function #(deliver p %)}) (publish-atom "ex1" "hello there" {}))
@p => "hello there"
publishes a message to the exchange (def p (promise)) (-> (atom {}) (common/install-routing routes) (add-consumer-atom "q1" {:id :bar :sync true :function #(deliver p %)}) (publish-atom "ex1" "hello there" {})) @p => "hello there"
(route? {:keys [type] :as meta}
{:keys [key headers] :as package}
{:keys [routing-key arguments] :as bind-opts})
checks if a message will be routed
(route? {:type "fanout"} {} {}) => true
(route? {:type "topic"} {:key "user.account.login"} {:routing-key ".account."}) => true
(route? {:type "header"} {:headers {"account" "login"}} {:arguments {"account" "*"}}) => true
checks if a message will be routed (route? {:type "fanout"} {} {}) => true (route? {:type "topic"} {:key "user.account.login"} {:routing-key "*.account.*"}) => true (route? {:type "header"} {:headers {"account" "login"}} {:arguments {"account" "*"}}) => true
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close