January 2018
Intermediate to advanced
336 pages
7h 56m
English
The Alert microservice of the Helping Hands application receives the alert messages over the Kafka topic that is used to send the alert in an email. To send an email as soon as the message is received, it can be integrated within the loop that looks for a message published by the producer, as shown here:
(defn consume-records "Consume the records using given consumer" [consumer result] (while true (doseq [record (.poll consumer 1000)] (try (let [rmsg (jp/parse-string (.value record)) msg (into {} (filter (comp some? val) {:from (conf/get-config [:alert :from]) :to (get rmsg "to" (conf/get-config [:alert :to])) :cc (rmsg "cc") :subject (rmsg "subject") :body (rmsg "body")})) result (postal/send-message ...Read now
Unlock full access