Skip to content

Instantly share code, notes, and snippets.

View lbradstreet's full-sized avatar

Lucas Bradstreet lbradstreet

View GitHub Profile
Host onyx-kafka
HostName github.com
User git
IdentityFile /home/ubuntu/.ssh/id_onyx-kafka
IdentitiesOnly yes
Host onyx-kafka-0.8
HostName github.com
User git
IdentityFile /home/ubuntu/.ssh/id_onyx-kafka-0.8
IdentitiesOnly yes
FROM debian:wheezy
ENV DEBIAN_FRONTEND noninteractive
# Oracle Java 8
RUN apt-get update \
&& apt-get install -y wget openssl ca-certificates \
&& cd /tmp \
&& wget -qO jdk8.tar.gz \

The Anatomy of an Onyx Program

In this tutorial, we'll take an in-depth view of what's happening when you execute a simple Onyx program. All of the code can be found in the Onyx Starter repository if you'd like to follow along. The code uses the development environment with HornetQ and ZooKeeper running in memory, so you don't need additional dependencies to run the example for yourself on your machine.

The Workflow

At the core of the program is the workflow - the flow of data that we ingest, apply transformations to, and send to an output for storage. In this program, we're going to ingest some sentences from an input source, split the sentence into individual words, play with capitalization, and add a suffix. Finally, we'll send the transformed data to an output source.

Let's examine the workflow pictorially:

(filter even? (range 10))
;; equals
(new clojure.lang.LazySeq
(fn []
(when-let
[s (. clojure.lang.RT
(seq (new clojure.lang.LazySeq
#(let [b (clojure.lang.ChunkBuffer. 32)
(defmacro defntraced
"Define a function with it's inputs and output logged to the console."
[sym & body]
(let [[_ _ [_ & specs]] (macroexpand `(defn ~sym ~@body))
new-specs (map
(fn [[args body]]
(let [prns (for [arg args]
`(js/console.log (str '~arg) "=" (pr-str ~arg)))]
(list
args
@lbradstreet
lbradstreet / ux.cljs
Created January 22, 2014 02:39 — forked from anonymous/ux.cljs
;;; TODO - drag-enter and -exit events : Right now, a component doesn't receive events for other components
;;; If a component responds to drag-over, it won't "revert" state until the drag ends.
;; NOTE - compiles with om 0.1.7. Needs updating to 0.2+
(ns omdnd.ux
(:require-macros
[cljs.core.async.macros :refer [go alt!]]
)
if exists("g:loaded_syntastic_clojure_nrepl_checker")
finish
endif
let g:loaded_syntastic_clojure_nrepl_checker=1
function! SyntaxCheckers_clojure_nrepl_IsAvailable()
return executable('lein') && filereadable('project.clj')
endfunction
function! SyntaxCheckers_clojure_nrepl_GetLocList()