Skip to content

Instantly share code, notes, and snippets.

@rboyd
Created November 27, 2012 21:34
Show Gist options
  • Save rboyd/4157220 to your computer and use it in GitHub Desktop.
Save rboyd/4157220 to your computer and use it in GitHub Desktop.
consumer example
(ns consumer
(:import [javax.jms Connection Message MessageConsumer Queue Session MessageListener TextMessage])
(:import [org.hornetq.api.core TransportConfiguration])
(:import [java.util HashMap Map])
(:import [org.hornetq.api.jms HornetQJMSClient JMSFactoryType])
(:import [org.hornetq.jms.client HornetQConnectionFactory]))
(def props (java.util.HashMap. {"host" "somehost" "port" (Integer. 1234) "use-nio" true}))
(def transportConfig (TransportConfiguration. "org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" props))
(def hqFactory (HornetQJMSClient/createConnectionFactoryWithoutHA JMSFactoryType/CF ^"[Lorg.hornetq.api.core.TransportConfiguration;" (into-array [transportConfig])))
(def queue (HornetQJMSClient/createQueue "SomeQueue"))
(def connection (.createConnection hqFactory))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment