Commit dd6a9066 authored by Marco Gonzalez Hierro's avatar Marco Gonzalez Hierro

Added konnekt JSON format in NOOP export format

parent 48a0fa9d
......@@ -2,6 +2,7 @@
This fork includes the following changes to edinburgh (1.0.0) version of edgex-go:
- [Export Distro] Added CA cert to MQTT secure connection (located in /certs/ca.pem)
- [Export Distro] Added a workaround to use KonnektBox message format (JSON) inside NOOP handler
- [Config Seed] Changed default config of export distro service to point certs in /certs/export.crt and /certs/export.key
# EdgeX Foundry Services
......
......@@ -211,6 +211,16 @@ type noopFormatter struct {
}
func (noopFmt noopFormatter) Format(event *contract.Event) []byte {
// Workaround to format KonnektBox messages
// Check if there are any readings and take the first
if len(event.Readings) > 0 {
// Check if reading is a valid JSON
value := []byte(event.Readings[0].Value)
if json.Valid(value) {
return value
}
LoggingClient.Error("Reading is not a valid JSON")
}
return []byte{}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment