Skip to content

Commit

Permalink
flatten details and content
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaslin committed Dec 21, 2015
1 parent f433e6c commit ea59a7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class RestProperties {
Boolean wrap = false
@NotEmpty
String url
Boolean flatten = false

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,18 @@ class RestEventListener implements EchoEventListener {
sentEvent = [
"eventName": "${service.config.eventName ?: eventName}" as String,
]

if (service.config.flatten) {
eventAsMap.content = mapper.writeValueAsString(eventAsMap.content)
eventAsMap.details = mapper.writeValueAsString(eventAsMap.details)
}

sentEvent["${service.config.fieldName ?: fieldName}" as String] = eventAsMap

}
service.client.recordEvent(sentEvent)
} catch (e) {
log.error("Could not send event ${eventAsMap} to ${service.config.url}")
log.error("Could not send event ${eventAsMap} to ${service.config.url}", e)
}
}
}
Expand Down

0 comments on commit ea59a7f

Please sign in to comment.