Permalink
Browse files

Broadcast queues should be exclusive, UUID-named.

  • Loading branch information...
1 parent 432d2bc commit 22ebc30e17f93a148751fe4b1a0824f8c405168e @technomancy committed Aug 27, 2011
Showing with 8 additions and 10 deletions.
  1. +2 −0 README.md
  2. +6 −10 src/die/roboter.clj
View
@@ -75,6 +75,8 @@ use the `with-robots` macro to bind it dynamically.
* Switch to tools.namespace once it's fixed
* Fix race condition in broadcast tests
* Control worker count via queue
+* Retry limit
+* Expose future exceptions to caller (issue #2)
## License
View
@@ -30,7 +30,8 @@
(:exchange-durable config true)
(:exchange-auto-delete config false))
(wabbit/queue-declare (:queue config "die.roboter.work")
- (:durable config true))
+ (:durable config true)
+ (:exclusive config false))
(wabbit/queue-bind (:queue config "die.roboter.work")
(:exchange config "die.roboter")
(:queue config "die.roboter.work"))
@@ -121,16 +122,11 @@
(*exception-handler* e msg)))))))
([] (work {:implicit true})))
-(def pid (-> (ManagementFactory/getRuntimeMXBean) .getName (.split "@") first))
-
-(def broadcast-queue-name
- (format "die.roboter.broadcast.%s.%s"
- (.getHostName (java.net.InetAddress/getLocalHost)) pid))
-
(defn work-on-broadcast
"Wait for work on the broadcast queue and eval it continually."
([config]
- (work (merge {:exchange "die.roboter.broadcast"
- :exchange-type "fanout"
- :queue broadcast-queue-name} config)))
+ (work (merge {:exchange "die.roboter.broadcast", :exchange-type "fanout"
+ :exclusive true
+ :queue (str "die.roboter.broadcast." (UUID/randomUUID))}
+ config)))
([] (work-on-broadcast {:implicit true})))

0 comments on commit 22ebc30

Please sign in to comment.