Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

queues are being cleaned up now

  • Loading branch information...
commit 13955adede780853b8b9064609c54f7ab6c2bf9e 1 parent 48c3bef
@amitrathore authored
View
5 src/org/runa/swarmiji/mpi/transport.clj
@@ -4,6 +4,11 @@
(use 'org.rathore.amit.utils.logger)
(use 'org.rathore.amit.utils.rabbitmq)
+(defn send-message-no-declare [q-name q-message-object]
+ (with-swarmiji-bindings
+ (with-exception-logging
+ (send-message-if-queue q-name q-message-object))))
+
(defn send-message-on-queue [q-name q-message-object]
(with-swarmiji-bindings
(with-exception-logging
View
18 src/org/runa/swarmiji/sevak/sevak_core.clj
@@ -54,7 +54,7 @@
{:return-q-name return-q :sevak-name sevak-name :sevak-server-pid (process-pid)}
(handle-sevak-request sevak-name service-handler service-args))]
(if (and return-q (:return service-handler))
- (send-message-on-queue return-q response)))))
+ (send-message-no-declare return-q response)))))
(defn sevak-request-handling-listener [req-str]
(with-swarmiji-bindings
@@ -85,13 +85,15 @@
(future
(with-swarmiji-bindings
- (try
- (log-message "Listening for update broadcasts...")
- (start-queue-message-handler (sevak-fanout-exchange-name) FANOUT-EXCHANGE-TYPE (random-queue-name) sevak-request-handling-listener)
- (log-message "Done with broadcasts!")
- (catch Exception e
- (log-message "Error in update broadcasts future!")
- (log-exception e)))))
+ (let [broadcasts-q (random-queue-name "BROADCASTS_")]
+ (try
+ (log-message "Listening for update broadcasts...")
+ (.addShutdownHook (Runtime/getRuntime) (Thread. #(delete-queue broadcasts-q)))
+ (start-queue-message-handler (sevak-fanout-exchange-name) FANOUT-EXCHANGE-TYPE broadcasts-q (random-queue-name) sevak-request-handling-listener)
+ (log-message "Done with broadcasts!")
+ (catch Exception e
+ (log-message "Error in update broadcasts future!")
+ (log-exception e))))))
(future
(with-swarmiji-bindings
View
7 src/org/runa/swarmiji/utils/general_utils.clj
@@ -11,8 +11,11 @@
(defn return-queue-name [sevak-name]
(str (System/currentTimeMillis) "_" sevak-name "_" (random-uuid)))
-(defn random-queue-name []
- (random-uuid))
+(defn random-queue-name
+ ([]
+ (random-queue-name ""))
+ ([prefix]
+ (str prefix (random-uuid))))
(defn process-pid []
(let [m-name (.getName (ManagementFactory/getRuntimeMXBean))]
Please sign in to comment.
Something went wrong with that request. Please try again.