Last active
October 4, 2016 17:04
-
-
Save lbradstreet/b9366f228959b53fee62d1cb517c57bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns onyx.metrics.riemann-playground) | |
(require '[riemann.client :as r]) | |
(def c (r/tcp-client {:host "192.168.99.100" :port 35002})) | |
(defn intensive-computation [] | |
(let [prom (r/send-events c (repeat 100000 {:status "ok"}))] | |
(println "Obtained promise") | |
(println (deref prom 5000 ::timeout5000)))) | |
(def f (future | |
(try | |
(while (not (Thread/interrupted)) | |
(println (Thread/interrupted)) | |
(println "ready to go") | |
(println (intensive-computation))) | |
(catch Exception e | |
(println e) | |
(.interrupt (Thread/currentThread)) | |
(throw (RuntimeException. e))) | |
(finally (println "finally"))))) | |
(Thread/sleep 10000) | |
(future-cancel f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment