These notes accompany a talk I gave on the 6th of February at RubyFuza 2014.
- Twitter: @RobStuttaford
15-Aug-19 22:29:18 MacBook-Pro.local WARN [onyx.peer.task-lifecycle] - | |
java.lang.Thread.run Thread.java: 745 | |
java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java: 617 | |
java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java: 1142 | |
... | |
clojure.core.async/thread-call/fn async.clj: 405 | |
onyx.peer.task-lifecycle.TaskLifeCycle/fn task_lifecycle.clj: 706 | |
onyx.peer.task-lifecycle/run-task-lifecycle task_lifecycle.clj: 431 | |
onyx.peer.task-lifecycle/write-batch task_lifecycle.clj: 304 | |
onyx.plugin.datomic.DatomicLogInput/write-batch datomic.clj: 255 |
(ns onyx-tx-report-queue | |
(:require [clojure.core.async :refer [>!! alts!! chan close! put! thread]] | |
[clojure.tools.logging :as log] | |
;; :all so clj-refactor doesn't remove it: | |
[onyx.plugin.core-async :refer :all] | |
[datomic.api :as d]) | |
(:import [java.util.concurrent TimeUnit])) | |
(defn prepare-datom [db [e a v tx added]] | |
[e (d/ident db a) v tx added]) |
(let [dt #(-> (clj-time.core/date-time 2015 % %2) | |
clj-time.coerce/to-date) | |
now (d/db (d/connect (db/database-uri :main)))] | |
[(db/conn (db/database-uri :main)) | |
(vec | |
(for [db [now ;; 29th July 2015 | |
(-> now | |
(d/since (dt 2 1))) ;; 1st Feb 2015 | |
(-> now | |
(d/as-of (dt 2 1))) ;; 1st Feb 2015 |
{:environment :production | |
:global {:logging-config "./logback.xml"} | |
:onyx {:job-scheduler :onyx.job-scheduler/balanced | |
:task-scheduler :onyx.task-scheduler/balanced | |
:peer-config {:onyx.messaging/impl :netty | |
:onyx.messaging/peer-port-range [40200 40220] | |
:onyx.messaging/peer-ports [40199] | |
:onyx.messaging/bind-addr "localhost" | |
:onyx.messaging/backpressure-strategy :high-restart-latency} | |
:peer-count 20 |
(ns scratch | |
(:require [datomic.api :as d])) | |
(def u "datomic:mem://component-test") | |
(d/delete-database u) | |
(d/create-database u) | |
(def c (d/connect u)) |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; Connection | |
(defprotocol DatomicConnection | |
(as-conn [_])) | |
(extend-protocol DatomicConnection | |
datomic.Connection | |
(as-conn [c] c) | |
datomic.db.Db |
(ns app | |
(:require [om.core :as om :include-macros true])) | |
(defn log-tx [tx-data root-cursor] | |
(let [{:keys [path old-value new-value]} tx-data | |
c js/console] | |
(doto c (.group (str "TRANSACTION " path)) (.groupCollapsed "OLD")) | |
(prn (pr-str old-value)) | |
(doto c (.groupEnd) (.group "NEW")) | |
(prn (pr-str new-value)) |
These notes accompany a talk I gave on the 6th of February at RubyFuza 2014.
These notes accompany a talk I gave on the 9th of October at Tech4Africa 2013.
Twitter: @RobStuttaford