1

We have conditional requests on things- HTTP API or Ditto Protocol headers. Is there a way to restrict payload to get published into a topic in the ditto connections unless a conditional request is matched?

For example, in my twin I have a feature "connectionState" with value "Disconnected". I want to restrict publishing ditto protocol messages to a topic to update other features when the connectionState is Disconnected. Once the connectionState is "Connected", I want all the ditto protocol messages that have been published to update all the other features.

Is there such conditional request for ditto connections?

apoorva
  • 31
  • 4

1 Answers1

1

Yes, that can be configured as documented for connection target filters and in combination with requesting extraFields.

E.g.:

{
 "address": "<target-address>",
 "topics": [
   "_/_/things/twin/events?filter=ne(features/connectionState/properties/value,'Disconnected')&extraFields=features/connectionState/properties/value" 
 ],
 "authorizationContext": ["ditto:outbound-auth-subject", "..."]
}

That will publish twin events to the target address only if the connectionState is not Disconnected.

Thomas Jäckle
  • 1,123
  • 2
  • 7
  • 21