Advertisement
Guest User

Untitled

a guest
Oct 26th, 2015
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;; in publication.clj
  2. (def ^:private publisher-channel (chan))
  3.  
  4. (def ^:private publication
  5.   (pub publisher-channel (constantly :new-event)))
  6.  
  7. (defrecord PublicationComponent []
  8.   component/Lifecycle
  9.   (start [component]
  10.     (assoc component :publication publication))
  11.   (stop [component]
  12.     (unsub-all publication)
  13.     (dissoc component :publication)))
  14.  
  15. (defn publication-component []
  16.   (->PublicationComponent))
  17.  
  18. ;; in system.clj
  19. (defn new-system [config]
  20.  
  21.   (let [config (meta-merge base-config config)]
  22.     (-> (component/system-map
  23.          :publication   (publication-component))
  24.         (component/system-using
  25.          {:publication   []}))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement