This page is live and interactive powered by the klipse plugin:
(ns my.onyx
(:require [onyx-local-rt.api :as api]))
;; ^:export the function if using in ClojureScript.
(defn ^:export my-inc [segment]
(update-in segment [:n] inc))
(def job
{:workflow [[:in :inc] [:inc :out]]
:catalog [{:onyx/name :in
:onyx/type :input
:onyx/batch-size 20}
{:onyx/name :inc
:onyx/type :function
:onyx/fn ::my-inc
:onyx/batch-size 20}
{:onyx/name :out
:onyx/type :output
:onyx/batch-size 20}]
:lifecycles []})
(-> (api/init job)
(api/new-segment :in {:n 41})
(api/new-segment :in {:n 84})
(api/drain)
(api/stop)
(api/env-summary))