Source

resizer / src / resizer / fabric.clj

Diff from to

src/resizer/fabric.clj

             [langohr.exchange :as lhe]
             [langohr.core :as lhc]))
 
-;; declare exchanges using with-open
-(defn rabbitmq-connect []
+(defn rabbitmq-connect
+  []
   (if (cf/cloudfoundry?)
     (lhc/connect (lhc/settings-from (cfrmq/url)))
     (lhc/connect)))
 
-(defn declare-exchange [ch exchange]
-  (let [{name :name type :type opts :opts} exchange]
-    (lhe/declare ch name type opts)))
+(defn declare-exchange
+  [ch exchange]
+  (let [{name :name type :type} exchange
+        declare-ok (lhe/declare ch name type :durable true)]
+    declare-ok))
 
-(defn init-fabric [exchanges]
-  (let [conn       (rabbitmq-connect)
-        ch         (.createChannel conn)]
-    (map declare-exchange ch exchanges)
+(defn init-fabric
+  [exchanges]
+  (let [conn (rabbitmq-connect)
+        ch   (.createChannel conn)]
+    (doseq [exchange exchanges]
+      (declare-exchange ch exchange))
     (.close ch)
     (.close conn)))