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 support for twin life-cycle events #898

Closed
w4tsn opened this issue Nov 25, 2020 · 5 comments · Fixed by #1203
Closed

Add support for twin life-cycle events #898

w4tsn opened this issue Nov 25, 2020 · 5 comments · Fixed by #1203
Milestone

Comments

@w4tsn
Copy link
Contributor

w4tsn commented Nov 25, 2020

In order to integrate other components and services of an infrastructure for some use-cases it's crucial to act on life-cycle events of a twin. E.g. to register the twin on it's creation with monitoring, etc. Or to de-register when it is decommissioned.

Therefore the connectivity, HTTP and websocket APIs need means to filter for those events only. Otherwise one would have to listen on a potentially large data stream to manually fish out life-cycle events.

There is certainly even more potential in this concept, so let's discuss!

@thjaeckle
Copy link
Member

This makes sense, yes.
Would you also expect "lifecycle events" for e.g. created/removed features? I think that could be useful as well.
On a feature property/attribute level however I don't think that e.g. "attribute created" as separate lifecycle event would be so useful.

Regarding syntax: we would have to support it in the RQL queries, some ideas:

  • eq(__lifecycle,"CREATED") and eq(__lifecycle,"DELETED")
  • ... ?

@w4tsn
Copy link
Contributor Author

w4tsn commented Dec 2, 2020

For the features part, nice addition! I could think of RQL queries for those like this eq(__lifecycle/features/lamp,"CREATED").

So I'm currently further tracking life cycle states which might be really use-case dependent and not that helpful for a general implementation. Would have to think about that a bit more first, but here you go:

  • ACTIVE as in "put into duty" to mark that the device history is written to prod systems and those kind of things so we keep the initialization stuff separated from production
  • INACTIVE if the device is relocated, receives off the grid maintenance / upgrades or other things which are not considered "production updates"
  • RETIRED to mark that this device is now put out of service and maybe deleted or archived for later reference (our devices have unique IDs that also tie together history, alerting etc.)

I agree that property/attribute level events seem to be a bit over-kill

@thlandgraf
Copy link

Hi,

in our systems, we have a period of calibration validity (in german "Eichgültigkeit") in our lifecycle. Maybe, a "OUT_OF_GUARANEE" makes also sense.

best
   Thomas

@thjaeckle
Copy link
Member

Hi @thlandgraf
That sounds like a rather domain specific lifecycle (Ditto is domain agnostic) - can't this be an attribute instead?
On attributes, searching and filtering is already supported.

@thjaeckle
Copy link
Member

thjaeckle commented Sep 13, 2021

We start working on this issue.
The suggested approach is to make it possible to use topic:action (see connection scoped placeholders) in RQL expressions, e.g.:

eq(topic:action,'created')

or(eq(topic:action,'created'),eq(topic:action,'deleted'))

and(eq(topic:action,'created'),eq(attributes/location,'kitchen'))

Targeted is only the lifecycle of the thing/twin (as the title of the issue also suggests), feature lifecycle is out of scope for this issue.

@thjaeckle thjaeckle pinned this issue Sep 13, 2021
@thjaeckle thjaeckle added this to the 2.2.0 milestone Sep 23, 2021
thjaeckle added a commit to bosch-io/ditto-clients that referenced this issue Oct 6, 2021
…it is now a transitive dependency of ditto-protocol

* enhanced RunOSGiContainerIntegrationTest to test loading a "ditto-placeholders" class
* update logback to 1.2.6

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
thjaeckle added a commit to bosch-io/ditto that referenced this issue Oct 6, 2021
…termine the TopicPath for a given Signal

* move "instanceof" cascade to DefaultAdapterResolver to make it reusable
* simplified DittoProtocolAdapter, removed non-needed overloaded methods
* added SignalMapper implementations for ThingEvents and extracted the payload adding behavior for events to them
* added SearchErrorResponseAdapter

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
thjaeckle added a commit to bosch-io/ditto that referenced this issue Oct 6, 2021
…ic module "ditto-placeholders"

* make use of PlaceholderResolver in RQL ThingPredicateVisitor et. al
* move TopicPathPlaceholder from connectivity internals to "ditto-protocol"
* instantiate TopicPathPlaceholder with extracted TopicPath at places relying on RQL filtering

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
thjaeckle added a commit to bosch-io/ditto that referenced this issue Oct 6, 2021
Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
thjaeckle added a commit to bosch-io/ditto that referenced this issue Oct 6, 2021
…st be Java 8 compatible

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
thjaeckle added a commit to bosch-io/ditto that referenced this issue Oct 6, 2021
* optimized DefaultAdapterResolver to take less "instanceof" checks
* removed static addition for "topic:action" again from ThingsFieldExpressionFactoryImpl, this is not required
* made previously public methods in FieldExpressionUtil package private and exclude from API compatibility breakage

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
thjaeckle added a commit to bosch-io/ditto that referenced this issue Oct 6, 2021
…h "topic:action" for modified events and "topic:subject" for filtering live messages

* fixed found bug in Thing3ValuePredicateVisitor
* also apply filtering for non ThingEvents (e.g. live messages), but with empty thing

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
thjaeckle added a commit to bosch-io/ditto that referenced this issue Oct 6, 2021
…using RQL property "topic:" and "resource:"

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
thjaeckle added a commit to bosch-io/ditto that referenced this issue Oct 6, 2021
…ocumentation with "{{ }}", but plain

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
@thjaeckle thjaeckle unpinned this issue Oct 7, 2021
dguggemos added a commit that referenced this issue Oct 12, 2021
[#898] Add filtering for "topic:" and "resource:" placeholders in RQL expressions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants