     (let [tc (TransportConfiguration. (.getName NettyConnectorFactory))
           locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
           session-factory (.createSessionFactory locator)]
-      (assoc component :session-factory session-factory)))
-
-  (stop [component]
+      (assoc component
+        :locator locator
+        :session-factory session-factory)))
+
+  (stop [{:keys [locator session-factory] :as component}]
     (taoensso.timbre/info "Stopping HornetQ")
+
+    (.close session-factory)
+    (.close locator)
+    
     component))
 
 (defn hornetq [addr]

  (let [tc (TransportConfiguration. (.getName NettyConnectorFactory))
        locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
        session-factory (.createSessionFactory locator)
        session (.createSession session-factory)
        queue (:hornetq/queue-name task)
        consumer (.createConsumer session queue "" 0 64000 false)]
    (.start session)

  (let [tc (TransportConfiguration. (.getName NettyConnectorFactory))
        locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
        session-factory (.createSessionFactory locator)
        session (.createTransactedSession session-factory)
        queue (:hornetq/queue-name task)
        producer (.createProducer session queue)]
    (.start session)
