Liking cljdoc? Tell your friends :D

hara.platform.exchange


add-consumerclj

(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?}})
raw docstring

add-exchangeclj

(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?})
raw docstring

add-queueclj

(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?})
raw docstring

bind-exchangeclj

(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?]}}})
raw docstring

bind-queueclj

(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?]}}})
raw docstring

createclj

(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>
raw docstring

delete-consumerclj

(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?}})
raw docstring

delete-exchangeclj

(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?})
raw docstring

delete-queueclj

(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?})
raw docstring

exchangeclj

(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 #{}}}}
raw docstring

list-bindingsclj

(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?]}}})
raw docstring

list-consumersclj

(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?}})
raw docstring

list-exchangesclj

(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?})
raw docstring

list-queuesclj

(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?})
raw docstring

publishclj

(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"
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close