Can someone please look at the below code to see why it is not working. I 
am trying to write simple clojure code to send/receive message over 
activemq.

I am starting two REPL sessions and loading the same code below in each 
session. In one session I invoke the start-consumer function and in the 
other session the send-msg function. The REPL running the consumer code 
does not get the message.

(ns perf.prg
  (:require
    [clamq.activemq :as amq]
    [clamq.protocol.connection :as connection]
    [clamq.protocol.consumer :as consumer]
    [clamq.protocol.producer :as producer]))

(def broker-uri "tcp://MDCDSK01BHINDSA:61616")

(def connection (amq/activemq-connection broker-uri))

(def queue-name "producer-consumer-test-queue")

(defn recv-msg [message]
  (pprint (str "message received: " message)))

(defn start-consumer [connection]
  (let [consumer (connection/consumer connection {:endpoint queue-name 
:on-message recv-msg :transacted false})]
    (consumer/start consumer)
    (Thread/sleep 60000)
    (consumer/close consumer)))

(defn send-msg [connection msg]
  (let [producer (connection/producer connection)]
    (producer/publish producer queue-name msg)))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to