Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to configure pre-defined "extraFields" to be added to each emitted thingEvent #2072

Open
thjaeckle opened this issue Nov 29, 2024 · 0 comments · May be fixed by #2076
Open

Add option to configure pre-defined "extraFields" to be added to each emitted thingEvent #2072

thjaeckle opened this issue Nov 29, 2024 · 0 comments · May be fixed by #2076
Milestone

Comments

@thjaeckle
Copy link
Member

With the Ditto Signal Enrichment it is possible to dynamically configure for a single subscriber of "Thing Events" (whenever a Thing is modified) to get additional fields, which were not part of the change.
For example, all attributes or a special attribute which is required for the event consumer to have a context.

This works and is great.
However, this is also quite "costly" for Ditto - as the Gateway (for SSE and WebSocket) or Connectivity service of Ditto has to do another "internal" round-trip to fetch those extraFields. There are optimizations in place in order to cache them in a "smart cache" (which updates itself, etc.), but in the worst case, e.g. if the cache is full, this means a lot of roundtrips and networking.

There are scenarios when specific fields are always needed - that's why I suggest to configure (in the things service configuration) pre-defined extraFields which are pro-actively always sent in a DittoHeader field.
When the Connection or WebSocket "demands" this extraField (and e.g. no other), it can just use it from this header without additional roundtrips.
This should be configurable on a namespace level.

Example configuration:

pre-defined-extra-fields = [
  {
    namespaces = [
      "*"
    ]
    condition = "exists(definition)" # could be an option to also support a RQL condition here
    extra-fields = [
      "definition"
    ]
  },
  {
    namespaces = [
      "org.eclipse.ditto.lamps"
    ]
    extra-fields = [
      "attributes/manufacturer",
      "attributes/serial"
    ]
  }
]

One example use case behind this:

  • We want to always get the definition of a Thing to "know" its current thing model (and semantic version of it)
@thjaeckle thjaeckle added this to the 3.7.0 milestone Nov 29, 2024
@thjaeckle thjaeckle moved this to Todo in Ditto Planning Nov 29, 2024
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue Dec 16, 2024
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue Jan 2, 2025
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue Jan 2, 2025
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue Jan 2, 2025
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

1 participant