diff options
author | Adrian Batos-Parac <adrian.batos-parac@amdocs.com> | 2018-02-22 14:43:42 -0500 |
---|---|---|
committer | Adrian Batos-Parac <adrian.batos-parac@amdocs.com> | 2018-02-22 14:46:57 -0500 |
commit | e023325d3e76a71ac795ebbdb74f5a89756040a7 (patch) | |
tree | 63b2816a829c785f3c0329c3ea57ebd3c4f2937d /src/chameleon/event.clj | |
parent | 2610df2fc29a9d16bb869f652d4d21caeae4c154 (diff) |
Initial Commit of Chameleon
Commit the initial set of code for the Chameleon offering to ONAP
Change-Id: Ia58bd49eafc0a3702c17c9cab34d666ed1627ba5
Issue-ID: AAI-797
Signed-off-by: Adrian Batos-Parac <adrian.batos-parac@amdocs.com>
Diffstat (limited to 'src/chameleon/event.clj')
-rw-r--r-- | src/chameleon/event.clj | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/chameleon/event.clj b/src/chameleon/event.clj new file mode 100644 index 0000000..8201acb --- /dev/null +++ b/src/chameleon/event.clj @@ -0,0 +1,18 @@ +(ns chameleon.event + (:require [chameleon.txform] + [chameleon.route] + [integrant.core :as ig]) + (:import [org.onap.aai.event.client DMaaPEventConsumer])) + +(defmethod ig/init-key :chameleon/event + [_ {:keys [event-config gallifrey-host]}] + (let [{:keys [host topic motsid pass consumer-group consumer-id timeout batch-size type processor]} (:aai event-config) + event-processor (DMaaPEventConsumer. host topic motsid pass consumer-group consumer-id timeout batch-size type)] + (println "Event processor for AAI created. Starting event polling on " host topic) + (.start (Thread. (fn [] (while true + (let [it (.iterator (.consume event-processor))] + (println "Polling...") + (while (.hasNext it) + (let [event (.next it)] + (processor gallifrey-host event)))))))) + )) |