Way to understand if message error comes from device #1852
-
I send live messages to device using HTTP API. They are delivered to device through MQTT 5 (Mosquitto broker). Responses are expected to come using the same broker, different topic. Response payload can be anything - JSON or binary data, so I use RawMessage mapper. I need a reliable way to understand if response comes from device (if device received message and processed it successfully or not) or Ditto (if device wasn't able to respond in time or there was permission denied, or basically any other error). I tried specifying header mapping in RawMessage mapper configuration and in connection source configuration, but they do not appear in HTTP response headers. I noticed that if device responded via MQTT message, then HTTP response headers contain additional header "ditto-connection-id" with name of connection that provided the live-response acknowledgement. Unfortunately, I wasn't able to track this down fully in code, so I'm not sure about this. So, my question is: is checking for presence of "ditto-connection-id" header correct way to understand that response came from device (through Ditto connection)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @dimabarbul
Yes, this should work well .. |
Beta Was this translation helpful? Give feedback.
Hi @dimabarbul
Yes, this should work well ..
This header should be absent for all Ditto created "errors".