@petr has joined the channel
Hey all, quick question. I'd like to use mount to start several rabbitmq queues. In doing so I'm using a for to iterate over the queue names, start the queue, and returns a vector of vectors of [channel conn]. My issue is that the call to :stop is returning the following error:
No implementation of method: :close of protocol: #'langohr.core/Closeable
found for class: clojure.lang.PersistentVector. Is what I'm doing the wrong way to tackle this?And while I'm debugging, I'm unable to clear the defstate, so as a result am unable to iterate because when I start the queues. I'm unable to stop the component
looks like you are passing a vector to your :stop function that calls (close ..) on it
can you show the actual state definition?
I can indeed. give me 1 minute
(defstate zoom
:start (for [q [:my-queue]]
(let [[ch conn] (rmq/start-queue q)]
(log/info "Starting queue")
(rmq/subscribe-to-queue ch q handler)
[ch conn]))
:stop (let [queues zoom]
(for [[ch conn :as q] queues]
(prn "Stopping queue" )
(rmq/stop-queue ch conn))))
where do queues come from?
also I don't see q or zoom actually used in the :stop function
My bad, queues, should be zoom. Messed up removing identifiable information
can you do (println "stopping queue. channel:" ch ", connection:" conn) instead of (prn "Stopping queue" )?
I can, but each time I "start" the queues. I am unable to stop the queues as stop throws that error I pasted above. Is there a way to reset the state?
Without restarting my repl
there is a way to clear the reference, but in this case I would suggest to either:
* restart the repl if possible, since you would not want to leave stale connections around
* introspect #'yourns/zoom state to figure out how to stop it manually
at this point, I can see that the state code your provided is a bit psedo coded: i.e. there is also no handler + :as q is not used, etc.. so it is easier to restart the repl and see what println reveals
Heh, it seems that restarting the repl fixed this
I guess it was some left-over state that stopped this from working
Sorry, that stuff was there for debugging purposes, there is a little cleanup to be done
sure, not a problem. so your :stop function now works?
It does
great