Skip to content

Commit

Permalink
Merge pull request #13 from ciste/feature/manifold
Browse files Browse the repository at this point in the history
Replace eep with manifold
  • Loading branch information
duck1123 committed Oct 11, 2016
2 parents f28bdec + c849590 commit 3721151
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion project.clj
Expand Up @@ -7,13 +7,13 @@
:min-lein-version "2.0.0"
:dependencies [[clj-factory "0.2.1"]
[clj-http "3.3.0"]
[clojurewerkz/eep "1.0.0-beta1"]
[clojurewerkz/propertied "1.2.0"]
[com.taoensso/timbre "4.7.4"]
[compojure "1.5.1"]
[enlive "1.1.6"]
[environ "1.1.0"]
[inflections "0.12.2" :exclusions [commons-codec]]
[manifold "0.1.5"]
[org.clojure/clojure "1.8.0"]
[org.clojure/data.json "0.2.6"]
[xom "1.2.5"]]
Expand Down
17 changes: 8 additions & 9 deletions src/ciste/event.clj
@@ -1,20 +1,19 @@
(ns ciste.event
(:require [clojurewerkz.eep.emitter :as e]
(:require [manifold.bus :as bus]
[slingshot.slingshot :refer [throw+]]))

(defonce ^:dynamic *keys* (ref {}))

(defonce emitter
(e/create {:dispatcher-type :ring-buffer}))
(defonce events (bus/event-bus))

(defn notify
[channel-key msg]
[topic msg]
;; TODO: make sure that the channel is reqistered
(if-let [d (get @*keys* channel-key)]
(e/notify emitter channel-key (assoc msg :event channel-key))
(throw+ {:msg (str "No description for key: " channel-key)})))
(if-let [d (get @*keys* topic)]
(bus/publish! events topic (assoc msg :event topic))
(throw+ {:msg (str "No description for key: " topic)})))

(defn defkey
[channel-key desc & {:as body}]
[topic desc & {:as body}]
(dosync
(alter *keys* assoc channel-key (assoc body :desc desc))))
(alter *keys* assoc topic (assoc body :desc desc))))
3 changes: 1 addition & 2 deletions src/ciste/routes.clj
Expand Up @@ -62,12 +62,11 @@
(:require [ciste.config :refer [config]]
[ciste.core :refer [with-context apply-template serialize-as
*serialization*]]
[ciste.event :refer [defkey emitter notify]]
[ciste.event :refer [defkey notify]]
[ciste.filters :refer [filter-action]]
[ciste.formats :as formats]
[ciste.views :as views]
[clojure.string :as string]
[clojurewerkz.eep.emitter :refer [defobserver]]
[slingshot.slingshot :refer [throw+]]
[taoensso.timbre :as timbre]))

Expand Down

0 comments on commit 3721151

Please sign in to comment.