Skip to content

Commit

Permalink
uses mount/only to start and stop rabbit-mq states
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhang.balkundi committed Apr 11, 2022
1 parent f1f7ed4 commit 416cc20
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/ziggurat/init.clj
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
(mount/start))))

(defn- start-rabbitmq-connection [args]
(start* #{#'messaging-connection/consumer-connection} args)
(start* #{#'messaging-connection/connection} args)
(start* #{#'cpool/channel-pool} args))
(-> (mount/only #{#'messaging-connection/consumer-connection
#'messaging-connection/connection
#'cpool/channel-pool})
(mount/with-args args)
(mount/start)))

(defn- start-rabbitmq-consumers [args]
(start-rabbitmq-connection args)
Expand Down Expand Up @@ -80,9 +82,10 @@
(start-rabbitmq-consumers args))

(defn- stop-rabbitmq-connection []
(mount/stop #'cpool/channel-pool)
(mount/stop #'connection)
(mount/stop #'messaging-connection/consumer-connection))
(-> (mount/only #{#'connection
#'cpool/channel-pool
#'messaging-connection/consumer-connection})
(mount/stop)))

(defn stop-kafka-producers []
(mount/stop #'kafka-producers))
Expand Down

0 comments on commit 416cc20

Please sign in to comment.