Created
November 4, 2015 18:43
-
-
Save Samstiles/a6d947239ae8de8dda60 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn annotate-event | |
"Applies the context and id field to the provided source event." | |
[source-event id context] | |
(merge source-event {:id id :context context})) | |
(defn contextualize | |
"Parses a source event for identifiers that are representative of contexts (interactions, queues, resources, etc) and | |
annotates + replicates the event based on these contexts." | |
[source-event] | |
(let [{:keys [resource-id queue-id interaction-id]} source-event | |
replicated-events (cond-> [] | |
resource-id (conj (annotate-event source-event resource-id :resource)) | |
queue-id (conj (annotate-event source-event resource-id :queue)) | |
interaction-id (conj (annotate-event source-event resource-id :interaction)))] | |
(delegate-contextualized-events replicated-events))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment