Skip to content

Instantly share code, notes, and snippets.

View pjlegato's full-sized avatar

Paul Legato pjlegato

  • San Francisco, California
View GitHub Profile
@pjlegato
pjlegato / gist:8655414
Created January 27, 2014 19:12
Adding event listeners to Immutant InfiniSpan caches
(definterface CacheListenerInterface
(^void eventReceived [^org.infinispan.notifications.cachelistener.event.Event event]))
(deftype ^{org.infinispan.notifications.Listener {:sync true}} CacheListener []
CacheListenerInterface
(^{CacheEntryCreated {}} eventReceived [this event]
(println "Event received: " event)))
(defn dev-mode?
"Returns true if the app is running in dev mode."
[]
(let [project (registry/get :project)]
(not (or (System/getenv "LEIN_NO_DEV")
(->> project meta :active-profiles (not-any? #{:dev}))))))
@pjlegato
pjlegato / gist:5549745
Created May 9, 2013 19:08
Immutant get-queue function
(defn get-queue
"Returns the JMS queue object with the given name, if it exists."
[name]
(if-let [default (registry/get "jboss.messaging.default")]
(.getResource (.getManagementService default) (immutant.messaging.core/jms-name name))))