(add-consumer mq name handler)
adds a consumers to the m
(-> (exchange {:type :mock :routing routes :consumers consumers}) (add-consumer "q2" {:id :bar :sync true :function prn}) (list-consumers)) => (contains-in {"q1" {:hello map? :world map?} "q2" {:foo map? :bar map?}})
adds a consumers to the m (-> (exchange {:type :mock :routing routes :consumers consumers}) (add-consumer "q2" {:id :bar :sync true :function prn}) (list-consumers)) => (contains-in {"q1" {:hello map? :world map?} "q2" {:foo map? :bar map?}})
(add-exchange mq name)
(add-exchange mq name opts)
adds an exchange to the mq
(-> (exchange {:type :mock :routing routes}) (add-exchange "ex3") (list-exchanges)) => (contains {"ex1" map? "ex2" map? "ex3" map?})
adds an exchange to the mq (-> (exchange {:type :mock :routing routes}) (add-exchange "ex3") (list-exchanges)) => (contains {"ex1" map? "ex2" map? "ex3" map?})
(add-queue mq name)
(add-queue mq name opts)
adds a queue to the mq
(-> (exchange {:type :mock :routing routes}) (add-queue "q3") (list-queues)) => (contains {"q1" map? "q2" map? "q3" map?})
adds a queue to the mq (-> (exchange {:type :mock :routing routes}) (add-queue "q3") (list-queues)) => (contains {"q1" map? "q2" map? "q3" map?})
(bind-exchange mq source dest)
(bind-exchange mq source dest opts)
binds a queue to the exchange
(-> (exchange {:type :mock :routing routes}) (add-exchange "ex3") (bind-exchange "ex1" "ex3") (list-bindings)) => (contains-in {"ex1" {:exchanges {"ex2" [map?] "ex3" [map?]} :queues {"q1" [map?]}} "ex2" {:queues {"q2" [map?]}}})
binds a queue to the exchange (-> (exchange {:type :mock :routing routes}) (add-exchange "ex3") (bind-exchange "ex1" "ex3") (list-bindings)) => (contains-in {"ex1" {:exchanges {"ex2" [map?] "ex3" [map?]} :queues {"q1" [map?]}} "ex2" {:queues {"q2" [map?]}}})
(bind-queue mq source dest)
(bind-queue mq source dest opts)
binds an exchange to the exchange
(-> (exchange {:type :mock :routing routes}) (add-queue "q3") (bind-queue "ex1" "q3") (list-bindings)) => (contains-in {"ex1" {:exchanges {"ex2" [map?]} :queues {"q1" [map?] "q3" [map?]}} "ex2" {:queues {"q2" [map?]}}})
binds an exchange to the exchange (-> (exchange {:type :mock :routing routes}) (add-queue "q3") (bind-queue "ex1" "q3") (list-bindings)) => (contains-in {"ex1" {:exchanges {"ex2" [map?]} :queues {"q1" [map?] "q3" [map?]}} "ex2" {:queues {"q2" [map?]}}})
(create m)
creates a exchange that is component compatible
(exchange/create {:type :mock :file {:path "dev/scratch/test.edn" :reset true}}) ;;=> #exchange.mock<uninitiased>
creates a exchange that is component compatible (exchange/create {:type :mock :file {:path "dev/scratch/test.edn" :reset true}}) ;;=> #exchange.mock<uninitiased>
(delete-consumer mq name id)
deletes the consumer from the queue
(-> (exchange {:type :mock :routing routes :consumers consumers}) (delete-consumer "q1" :hello) (list-consumers)) => (contains-in {"q1" {:world map?} "q2" {:foo map?}})
deletes the consumer from the queue (-> (exchange {:type :mock :routing routes :consumers consumers}) (delete-consumer "q1" :hello) (list-consumers)) => (contains-in {"q1" {:world map?} "q2" {:foo map?}})
(delete-exchange mq name)
removes an exchange from the mq
(-> (exchange {:type :mock :routing routes}) (delete-exchange "ex1") (list-exchanges)) => (contains {"ex2" map?})
removes an exchange from the mq (-> (exchange {:type :mock :routing routes}) (delete-exchange "ex1") (list-exchanges)) => (contains {"ex2" map?})
(delete-queue mq name)
deletes a queue from the mq
(-> (exchange {:type :mock :routing routes}) (delete-queue "q1") (list-queues)) => (contains {"q2" map?})
deletes a queue from the mq (-> (exchange {:type :mock :routing routes}) (delete-queue "q1") (list-queues)) => (contains {"q2" map?})
(exchange)
(exchange m)
creates an active exchange
(exchange {:type :mock :routing routes :file {:path "dev/scratch/test.edn" :reset true :cleanup true}}) ;;=> #exchange.mock ;; {:queues #{"q1" "q2"}, ;; :exchanges #{"ex1" "ex2"}, ;; :bindings {"ex1" {:exchanges #{"ex2"}, ;; :queues #{"q1"}}, ;; "ex2" {:queues #{"q2"}, ;; :exchanges #{}}}}
creates an active exchange (exchange {:type :mock :routing routes :file {:path "dev/scratch/test.edn" :reset true :cleanup true}}) ;;=> #exchange.mock ;; {:queues #{"q1" "q2"}, ;; :exchanges #{"ex1" "ex2"}, ;; :bindings {"ex1" {:exchanges #{"ex2"}, ;; :queues #{"q1"}}, ;; "ex2" {:queues #{"q2"}, ;; :exchanges #{}}}}
(list-bindings mq)
returns current list of exchanges
(-> (exchange {:type :mock :routing routes}) (list-bindings)) => (contains-in {"ex1" {:exchanges {"ex2" [map?]} :queues {"q1" [map?]}} "ex2" {:queues {"q2" [map?]}}})
returns current list of exchanges (-> (exchange {:type :mock :routing routes}) (list-bindings)) => (contains-in {"ex1" {:exchanges {"ex2" [map?]} :queues {"q1" [map?]}} "ex2" {:queues {"q2" [map?]}}})
(list-consumers mq)
lists all the consumers for the mq
(-> (exchange {:type :mock :routing routes :consumers consumers}) (list-consumers)) => (contains-in {"q1" {:hello map?, :world map?}, "q2" {:foo map?}})
lists all the consumers for the mq (-> (exchange {:type :mock :routing routes :consumers consumers}) (list-consumers)) => (contains-in {"q1" {:hello map?, :world map?}, "q2" {:foo map?}})
(list-exchanges mq)
returns current list of exchanges
(list-exchanges (exchange {:type :mock :routing routes})) => (contains {"ex1" map? "ex2" map?})
returns current list of exchanges (list-exchanges (exchange {:type :mock :routing routes})) => (contains {"ex1" map? "ex2" map?})
(list-queues mq)
returns current list of queues
(list-queues (exchange {:type :mock :routing routes})) => (contains {"q1" map? "q2" map?})
returns current list of queues (list-queues (exchange {:type :mock :routing routes})) => (contains {"q1" map? "q2" map?})
(publish mq exchange message)
(publish mq exchange message opts)
publishes a message to an exchange
(def p (promise))
(-> (exchange {:type :mock :routing routes :consumers {"q1" {:hello {:function #(deliver p %)}}}}) (publish "ex1" "hello there"))
@p => "hello there"
publishes a message to an exchange (def p (promise)) (-> (exchange {:type :mock :routing routes :consumers {"q1" {:hello {:function #(deliver p %)}}}}) (publish "ex1" "hello there")) @p => "hello there"
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close