You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: documentation/src/main/resources/pages/ditto/installation-operating.md
+80
Original file line number
Diff line number
Diff line change
@@ -385,6 +385,86 @@ entities (things/policies) and no-one other:
385
385
386
386
These system properties would have to be configured for the "things" and "policies" services.
387
387
388
+
## Configuring pre-defined extra fields
389
+
390
+
Starting with Ditto 3.7.0, it is possible to configure [enrichment of `extraFields`](basic-enrichment.html) statically
391
+
via the configuration of the Ditto "things" service.
392
+
393
+
The benefit of doing this statically is a Ditto internal optimization to reduce internal traffic between Ditto services.
394
+
By default, Ditto will internally do an additional roundtrip from an "edge" service ("gateway" or "connectivity") to the
395
+
"things" service in order to retrieve configured `extraFields` (of a [managed connection](basic-connections.html#target-topics-and-enrichment) or
396
+
e.g. a [WebSocket session](httpapi-protocol-bindings-websocket.html#enrichment)).
397
+
398
+
Those retrieved `extraFields` are additionally cached, so also require some memory as well.
399
+
400
+
If for a Ditto installation the `extraFields` are known upfront and will not change dynamically, it is possible to configure
401
+
them in the [things.conf](https://github.com/eclipse/ditto/blob/master/things/service/src/main/resources/things.conf).
402
+
403
+
This configuration is something for power operators of Ditto, needing to reduce resources and improving resiliency by
404
+
reducing internal lookups.
405
+
406
+
### Pre-defined extra fields configuration
407
+
408
+
The configuration can be done for:
409
+
* events: Thing Events emitted to subscriber
410
+
* messages: Thing Messages forwarded by Ditto to message subscribers
411
+
412
+
Available options:
413
+
*`pre-defined-extra-fields`: a list of pre-defined extra fields configurations
414
+
*`namespaces`: a list of namespaces for which the configuration applies
415
+
* if this list is empty, the configuration applies to all namespaces
416
+
* the entries support wildcards (`*` matches any number of characters, `?` matches exactly one character)
417
+
*`condition`: a [RQL condition](basic-rql.html) to check if the extra fields should be added
418
+
*`extra-fields`: a list of extra fields (as JsonPointers) to proactively add for all matching `namespaces` and `condition` combinations
419
+
420
+
Example configuration:
421
+
```hocon
422
+
ditto {
423
+
things {
424
+
thing {
425
+
event {
426
+
pre-defined-extra-fields = [
427
+
{
428
+
namespaces = []
429
+
condition = "exists(definition)"
430
+
extra-fields = [
431
+
"definition"
432
+
]
433
+
},
434
+
{
435
+
namespaces = [
436
+
"org.eclipse.ditto.lamps"
437
+
]
438
+
extra-fields = [
439
+
"attributes/manufacturer",
440
+
"attributes/serial"
441
+
]
442
+
}
443
+
]
444
+
}
445
+
446
+
message {
447
+
pre-defined-extra-fields = [
448
+
{
449
+
namespaces = []
450
+
condition = "exists(definition)"
451
+
extra-fields = [
452
+
"definition"
453
+
]
454
+
}
455
+
]
456
+
//...
457
+
}
458
+
```
459
+
460
+
The above example configuration would always proactively send the `definition` of all Things (if it exists) in the published events
461
+
and all messages.
462
+
If a consumer of events or messages is interested in this `extraField`, this would not lead to an additional internal
463
+
lookup in Ditto and save an internal roundtrip + caching of the result.
464
+
465
+
For the namespace `org.eclipse.ditto.lamps` there would even be some defined attributes pre-defined to be available as
466
+
`extraFields` without the need for another internal lookup.
467
+
388
468
## Limiting Indexed Fields
389
469
390
470
The default behavior of Ditto is to index the complete JSON of a thing, which includes all its attributes and features. This may not be desired behavior for certain use cases:
0 commit comments