Connection sources
A connection will consume commands and messages from the sources configured within the connection. A source configuration comprises the address and the authorization.
Find examples at https://www.eclipse.org/ditto/basic-placeholders.html
Supported placeholders for address filters
For address filters of sources we support thing placeholders and the placeholder functions.
Thing placeholders
{{ thing:id }}
The full ID is composed of a namespace, a colon as a separator, and a name.
thingId = <namespace> + ":" + <thing-name>
Example my.namespace:thing-01
{{ thing:namespace }}
The namespace is the first part of the thing ID.
{{ thing:name }}
The thing name is the second part of the thing ID.
Placeholder functions
fn:default(<string|placeholder> defaultValue)
This placeholder function will pass the defaultValue
if the previous
expression in a pipeline has been resolved to empty (e.g. due to a
non-defined header placeholder key).
Another placeholder may be specified, which is resolved to a string and
inserted as defaultValue
.
Examples
{{ header:my-optional-header | fn:default('fallback') }}
{{ header:my-optional-header | fn:default("fallback") }}
{{ thing:name | fn:substring-before(':') | fn:default(thing:name) }}
fn:substring-before(<string> givenString)
This placeholder function will parse the result of the previous
expression, then it will pass along only the characters before the
first occurrence of the givenString
.
If givenString
is not contained, this function will resolve to empty.
Examples
{{ thing:id | fn:substring-before(':') }}
{{ thing:id | fn:substring-before(":") }}
{{ thing:name | fn:substring-before(':') | fn:default(thing:id) }}
fn:substring-after(<string> givenString)
This placeholder function will parse the result of the previous
expression, then it will pass along only the characters after the
first occurrence of givenString
.
If givenString
is not contained, this function will resolve to empty.
Examples
{{ thing:id | fn:substring-after(':') }}
{{ thing:id | fn:substring-after(":") }}
{{ thing:name | fn:substring-after(':') | fn:default(thing:id) }}
fn:lower()
This placeholder function makes the string result of the previous expression lowercase in total.
Examples
{{ thing:name | fn:lower() }}
fn:upper()
This placeholder function makes the string result of the previous expression uppercase in total.
Examples
{{ thing:name | fn:upper() }}
Supported placeholders for authorization
MQTT does not support to make use of placeholders for
authorization.
Header placeholders
Header placeholders allow accessing any external or Bosch IoT Things protocol header.
{{ header: }}
This placeholder supports any external protocol header or Things header.
Examples
{{ header:correlation_id }}
{{ header:device_id }}
Placeholder functions
See upper section Placeholder functions
Supported placeholders for header mappings
Define custom header mappings for this source. Those headers are passed as Ditto headers and can be accessed e.g. in a payload mapping. Useful header mappings for sources might be for example correlation-id, content-type.
content-type ⇾ {{ header:content-type }}
message-id ⇾ {{ header:correlation-id }}
status ⇾ {{ header:status }}
Thing placeholders
{{ thing:id }}
The full ID is composed of a namespace, a colon as a separator, and a name.
thingId = <namespace> + ":" + <thing-name>
Example my.namespace:thing-01
{{ thing:namespace }}
The namespace is the first part of the thing ID.
{{ thing:name }}
The thing name is the second part of the thing ID.
Topic placeholders
The Ditto protocol defines a topic for each protocol message having following structure:
{namespace}/{entityName}/{group}/{channel}/{criterion}/{action}
Example my.namespace/thing-01/things/live/events/modified
{{ topic:full }}
The placeholder is resolved into the full Ditto protocol topic path.
See https://www.eclipse.org/ditto/protocol-specification-topic.html
{{ topic:namespace }}
The placeholder is resolved into the Ditto protocol namespace.
{{ topic:entityId }}
Deprecated. Use {{ topic.entityName }} instead.
{{ topic:entityName }}
The placeholder is resolved into the Ditto protocol entity Name.
{{ topic:group }}
Ditto protocol group
See https://www.eclipse.org/ditto/protocol-specification-topic.html#group
{{ topic:channel }}
The placeholder is resolved into the Ditto protocol channel.
{{ topic:criterion }}
The placeholder is resolved into the Ditto protocol criterion.
{{ topic:action }}
The placeholder is resolved into the Ditto protocol action.
{{ topic:subject }}
The placeholder is resolved into the Ditto protocol subject (for message commands).
{{ topic:action-subject }}
Placeholder for a Ditto protocol action or subject (for message commands)
Header placeholders
{{ header: }}
This placeholder supports any external protocol header or Things header.
Examples
{{ header:correlation_id }}
{{ header:device_id }}
Subject ID placeholder
{{ request:subjectId }}
This placeholder resolves to the authorization subject that issued the command or caused the event.
Placeholder functions
See upper section Placeholder functions.