Skip to content

Commit a51ae55

Browse files
authored
Merge pull request #539 from bsinno/feature/connection-status
Extend connectivity payload mapping capabilities
2 parents dddd3a0 + 8e3f846 commit a51ae55

140 files changed

Lines changed: 4871 additions & 1616 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

documentation/src/main/resources/_data/sidebars/ditto_sidebar.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ entries:
3535
- title: Milestone releases
3636
output: web
3737
subfolderitems:
38+
- title: 1.0.0-M2
39+
url: /release_notes_100-M2.html
40+
output: web
3841
- title: 1.0.0-M1a
3942
url: /release_notes_100-M1a.html
4043
output: web
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: "Announcing Ditto Milestone 1.0.0-M2"
3+
published: true
4+
permalink: 2019-11-04-milestone-announcement-100-M2.html
5+
layout: post
6+
author: thomas_jaeckle
7+
tags: [blog]
8+
hide_sidebar: true
9+
sidebar: false
10+
toc: false
11+
---
12+
13+
The second and last milestone of the upcoming release
14+
[1.0.0](https://projects.eclipse.org/projects/iot.ditto/releases/1.0.0) was released today.
15+
16+
Have a look at the Milestone [1.0.0-M2 release notes](release_notes_100-M2.html) for what changed in detail.
17+
18+
The main changes and new features since the last release [1.0.0-M1a release notes](release_notes_100-M1a.html) are
19+
20+
* invoking custom foreign HTTP endpoints as a result of events/messages
21+
* ability to reflect Eclipse Hono's device connection state in Ditto's things
22+
* support for OpenID Connect / OAuth2.0 based authentication in Ditto Java Client
23+
* configurbale throttling of max. consumed WebSocket commands / time interval
24+
25+
## Artifacts
26+
27+
The new Java artifacts have been published at the [Eclipse Maven repository](https://repo.eclipse.org/content/repositories/ditto/)
28+
as well as [Maven central](https://repo1.maven.org/maven2/org/eclipse/ditto/).
29+
30+
The Docker images have been pushed to Docker Hub:
31+
* [eclipse/ditto-policies](https://hub.docker.com/r/eclipse/ditto-policies/)
32+
* [eclipse/ditto-things](https://hub.docker.com/r/eclipse/ditto-things/)
33+
* [eclipse/ditto-things-search](https://hub.docker.com/r/eclipse/ditto-things-search/)
34+
* [eclipse/ditto-gateway](https://hub.docker.com/r/eclipse/ditto-gateway/)
35+
* [eclipse/ditto-connectivity](https://hub.docker.com/r/eclipse/ditto-connectivity/)
36+
* [eclipse/ditto-concierge](https://hub.docker.com/r/eclipse/ditto-concierge/)
37+
38+
<br/>
39+
<br/>
40+
{% include image.html file="ditto.svg" alt="Ditto" max-width=500 %}
41+
--<br/>
42+
The Eclipse Ditto team

documentation/src/main/resources/jsonschema/connection.json

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,22 @@
179179
"title": "Header mapping configuration",
180180
"description": "Headers to map for each incoming message (after the optional payload transformation) from the source's protocol headers to internal DittoHeaders.",
181181
"additionalProperties": false,
182-
"patternProperties":
183-
{
184-
"^.+$":
185-
{
182+
"patternProperties": {
183+
"^.+$": {
186184
"title": "header value",
187185
"description": "The key is the internal DittoHeader key to set, the value can make use of placeholders in order to access external header values via `{{ header:[any-header-name] }}`, the Thing ID via `{{ thing:id }}` or to access the DittoProtocol topic via `{{ topic:[topic-placeholder-attr] }}`.",
188186
"type": "string"
189187
}
190188
}
189+
},
190+
"payloadMapping": {
191+
"$id": "/properties/sources/items/properties/payloadMapping",
192+
"type": "array",
193+
"description": "References the IDs of payload mappers defined in the payload mapping definitions that are applied to messages received via this source.",
194+
"items": {
195+
"title": "Payload definition reference",
196+
"type": "string"
197+
}
191198
}
192199
}
193200
}
@@ -255,15 +262,22 @@
255262
"title": "Header mapping configuration",
256263
"description": "Headers to map for each outgoing message (after the optional payload transformation) from the internal DittoHeaders to the targets's protocol headers.",
257264
"additionalProperties": false,
258-
"patternProperties":
259-
{
260-
"^.+$":
261-
{
265+
"patternProperties": {
266+
"^.+$": {
262267
"title": "header value",
263268
"description": "The key is the external header key to set, the value can make use of placeholder in order to access DittoHeader values via `{{ header:[any-header-name] }}`, the Thing ID via `{{ thing:id }}` or to access the DittoProtocol topic via `{{ topic:[topic-placeholder-attr] }}`.",
264269
"type": "string"
265270
}
266271
}
272+
},
273+
"payloadMapping": {
274+
"$id": "/properties/targets/items/properties/payloadMapping",
275+
"type": "array",
276+
"description": "References the IDs of payload mappers defined in the payload mapping definitions that are applied to messages received via this target.",
277+
"items": {
278+
"title": "Payload definition reference",
279+
"type": "string"
280+
}
267281
}
268282
}
269283
}
@@ -311,45 +325,45 @@
311325
"title": "Specific config",
312326
"description": "Depending on the configured connection type, there might be protocol specific configuration options or tuning settings available. These can be configured in the specific config object. The specific config object is interpreted as a key value based map of setting properties.",
313327
"additionalProperties": false,
314-
"patternProperties":
315-
{
316-
"^.+$":
317-
{
328+
"patternProperties": {
329+
"^.+$": {
318330
"title": "Setting value",
319331
"description": "Setting value",
320332
"type": "string"
321333
}
322334
}
323335
},
324-
"mappingContext": {
325-
"$id": "/properties/mappingContext",
336+
"mappingDefinitions": {
337+
"$id": "/properties/mappingDefinitions",
326338
"type": "object",
327-
"title": "The mapping context for this connection",
328-
"properties": {
329-
"mappingEngine": {
330-
"$id": "/properties/mappingContext/properties/mappingEngine",
331-
"type": "string",
332-
"title": "Mapping engine",
333-
"description": "The Mapping engine defines which kind of mapping processor is instantiated for this connection. Currently you can choose between \"javascript\" and a full qualified java class name implementing the MessageMapper interface. If you go for the second option, make sure the implementation class is available in CLASSPATH."
334-
},
335-
"options": {
336-
"$id": "/properties/mappingContext/properties/options",
337-
"type": "object",
338-
"title": "Options",
339-
"description": "The mapping options contain specific configuration settings for the selected mapping engine. The options object is interpreted as a key value based map of setting properties.",
340-
"additionalProperties": false,
341-
"patternProperties":
342-
{
343-
"^.+$":
344-
{
345-
"title": "Setting value",
346-
"description": "Setting value",
347-
"type": "string"
339+
"additionalProperties": {
340+
"type": "object",
341+
"description": "The payload mapping definitions.",
342+
"properties": {
343+
"mappingEngine": {
344+
"$id": "/properties/mappingDefinitions/properties/mappingEngine",
345+
"type": "string",
346+
"title": "Mapping engine",
347+
"description": "The Mapping engine defines which kind of mapping processor is instantiated for this connection. Currently you can choose between `Ditto`, `JavaScript`, `Normalized` and `ConnectionStatus`. The payload mapper documentation provides a detailed description of available mappers or how to bring your own mapper."
348+
},
349+
"options": {
350+
"$id": "/properties/mappingDefinitions/properties/options",
351+
"type": "object",
352+
"title": "Options",
353+
"description": "The mapping options contain specific configuration settings for the selected mapping engine. The options object is interpreted as a key value based map of setting properties.",
354+
"additionalProperties": false,
355+
"patternProperties": {
356+
"^.+$": {
357+
"title": "Setting value",
358+
"description": "Setting value",
359+
"type": "string"
360+
}
348361
}
349362
}
350-
}
351-
},
352-
"required": [ "mappingEngine", "options"]
363+
},
364+
"additionalProperties": false,
365+
"required": [ "mappingEngine" ]
366+
}
353367
}
354368
},
355369
"additionalProperties": false,

documentation/src/main/resources/pages/ditto/basic-connections.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ A connection source can only receive data for Things to which it has WRITE right
219219
Some [connection types](#connection-types) require specific configuration which are not supported for other connection types.
220220
Those are put into the `specificConfig` field.
221221

222-
### Mapping context
222+
### Payload Mapping
223223

224-
For more information on the `mappingContext` see the corresponding [Payload Mapping Documentation](connectivity-mapping.html).
224+
For more information on mapping message payloads see the corresponding [Payload Mapping Documentation](connectivity-mapping.html).
225225

226226
## Placeholders
227227

documentation/src/main/resources/pages/ditto/basic-feature.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,18 @@ The following snippet shows a Feature with the ID "arbitrary-feature" and a defi
5656

5757
```json
5858
{
59-
"arbitrary-feature": {
60-
"definition": [ "org.eclipse.ditto:complex-type:1.0.0" ],
61-
"properties": {
62-
"connected": true,
63-
"complexProperty": {
64-
"street": "my street",
65-
"house no": 42
66-
}
59+
"arbitrary-feature": {
60+
"definition": [ "org.eclipse.ditto:complex-type:1.0.0" ],
61+
"properties": {
62+
"status": {
63+
"connected": true,
64+
"complexProperty": {
65+
"street": "my street",
66+
"house no": 42
6767
}
68+
}
6869
}
70+
}
6971
}
7072
```
7173

documentation/src/main/resources/pages/ditto/connectivity-manage-connections.md

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,16 +299,36 @@ Clears all currently stored connection logs.
299299

300300
## Payload mapping configuration
301301

302-
To enable a custom [payload mapping](connectivity-mapping.html) for a specific connection, you have to configure a
303-
mapping context in the connection configuration object. The following snippet shows an example `mappingContext`. This
304-
configuration must be embedded in the connection configuration as shown in the [Connections](basic-connections.html) section.
302+
To enable a custom [payload mapping](connectivity-mapping.html) for a specific source or target of a connection, you
303+
have to configure a payload mapping definition in the connection configuration object. The following snippet shows an
304+
example `mappingDefinitions`. This configuration must be embedded in the connection configuration as shown in the
305+
[Connections](basic-connections.html) section. These payload mapping definitions are then referenced by its ID
306+
(the key of the JSON object) in the sources and targets of the connection using the field `payloadMapping`.
307+
If no payload mapping or definition is provided, the [Ditto message mapping](connectivity-mapping.html#ditto-mapper)
308+
is used as the default.
305309

306310
```json
307-
"mappingContext": {
308-
"mappingEngine": "JavaScript",
309-
"options": {
310-
"incomingScript": "..",
311-
"outgoingScript": ".."
311+
{
312+
...
313+
"mappingDefinitions": {
314+
"customJs": { // (1)
315+
"mappingEngine": "JavaScript", // (2)
316+
"options": { // (3)
317+
"incomingScript": "..",
318+
"outgoingScript": ".."
319+
}
320+
}
321+
},
322+
"sources": [
323+
{
324+
"addresses": "source",
325+
"payloadMapping": ["customJs"]
312326
}
313-
}
327+
]
328+
...
329+
}
314330
```
331+
332+
- (1) This ID can be used in sources and targets of the connection to reference this payload mapping definition.
333+
- (2) The `mappingEngine` defines the underlying `MessageMapper` implementation.
334+
- (3) The `options` are used to configure the mapper instance to your needs.

0 commit comments

Comments
 (0)