ditto icon indicating copy to clipboard operation
ditto copied to clipboard

Process/forward messages conditionally based on on twin state

Open thjaeckle opened this issue 2 years ago • 0 comments

Similar to the conditional requests for CRUD of things it would be useful to apply a (RQL based) condition when processing messages in Ditto.

Example use cases:

  • prevent sending duplicated alarm/alert messages from devices using a flag in the twin state: POST /api/2/things/org.eclipse.ditto:my-thing-1/outbox/messages/fireAlarm?condition=ne(attributes/alarmConfirmed,true)
    • e.g. a (mobile) app which would receive the "fireAlarm" for the first would set the attributes/alarmConfirmed=true
    • this would prevent the mobile app to receive the fireAlarm multiple times
  • only dispatch messages to a device when it is currently online: POST /api/2/things/org.eclipse.ditto:my-thing-1/inbox/messages/doSomething?condition=gt(features/ConnectionStatus/properties/status/readyUntil,time:now)

thjaeckle avatar Apr 12 '22 07:04 thjaeckle