1

I am starting the ritz server in a thread and am communicating with it programmatically using the nrepl client:

(require '[clojure.tools.nrepl :as repl])
(def connection (repl/connect :port 15351)) ;; port of ritz-nrepl
(-> (repl/client connection 1000)
    (repl/message {:op "eval" :code '(+ 3 3)}))

(Some of this is based on http://hugoduncan.github.io/ritz-conj/#/5/2 )

This works great, I am getting a response from the ritz-nrepl server. But if I want to do something with frames:

(repl/message connection {:op "break-on-exception"})
(repl/message connection {:op "eval" :code '(/ 1 0)}) ;; empty response {} here
(repl/message connection {:op "frame-source" :frame-number 1})

This throws an exception because the "frame-source" op requires a :thread-id. But how do I know the thread id? I have inspected break-context and I see there are keys in the map that represent the thread id that are supposed to be looked up by the :thread-id passed in by me, but how am I supposed to know the :thread-id beforehand?

Thanks for any guidance!

prismofeverything
  • 8,799
  • 8
  • 38
  • 53
  • not posting an answer because I don't have the complete solution, but I think the key here is to use ritz.jdpa.debug/threads or ritz.jdpa.debug/thread-list to get the thread info (iirc this will get you not only a thread id but a state of the thread, and you can use the combination of those two to figure out which thread to operate on) – noisesmith May 16 '13 at 03:45

0 Answers0