Customers, who use the digital twin layer especially for routing messages to other applications, and are not mainly interested in persisting the device status as a digital twin, can use a prepared payload mapping to support such use cases out-of-the-box.
Managed connections to and from the digital twin layer can enable this new type of mapping.
For incoming messages, the mapper wraps the content which is not related to digital twin interactions into a configured live message envelope.
For outgoing message, the mapper extracts the payload of this live message envelope and publishes the wrapped payload into the target channel.
To enable and disable the raw message mapper, please use the HTTP API or the Connections UI.
The built-in payload mapper for incoming messages transforms any text, JSON, or binary message into a Ditto protocol “live message” with a pre-configured “subject”. Based on the content-type, the raw message is put as JSON string, as JSON object, or as base64-encoded JSON string.
Incoming messages, which already represent Ditto protocol messages (using content-type “application/vnd.eclipse.ditto+json”) are not transformed, but directly processed.
In case you send a message with content-type “application/json” or something similar to “application/vnd-XYZ+json”, the JSON payload type is assumed.
In case you send a message with content-type “application/vnd.eclipse.ditto+json”, an incoming mapping is not necessary, and the message will be processed as provided.
The built-in payload mapper for outgoing messages transforms the content of “live messages” back to the original payload. All other messages (twin events, etc.) are not transformed.
Please be aware, that if you use connection protocols without application headers (such as MQTT 3), the headers of your original message might get lost.
Enable and configure the template via Things UI
Enable and configure the template via HTTP API
Find a configuration example at Eclipse Ditto.