CRUD observations

From AMTech WikiDocs
Revision as of 16:07, 23 May 2019 by Lianet (Talk | contribs)

Jump to: navigation, search

Crud observations are produced when a thing instance is created, updated or deleted, and are sent to the topic /crud/<typeId>. The observations are sent if:

  • The thing type of the resource being modified, is configured as a Crud Producer in an activity
  • The resource is an instance of the core types AmtechM2mBridge or SmartTracker. (to the topics /crud/amtechM2mBridge and /crud/smartTracker)
    • For things of type AmtechM2mBridge, the crud observation is also sent to the topic /<typeId>/<instanceId>/crud ex./amtechM2mBridge/bridge1/crud (to be used by the edge logic)
  • The resource is contained inside a bridge instance (observation production, reasoners, actions, etc). They are only sent to the topic /amtechM2mBridge/bridge1/crud.
    • For all new/update/delete operations on a resource contained in a reasoner, a generic crud observation is generated
      • Indicates that the property 'reasoners' changed. Note that the change might have been in any resource contained in the reasoner
      • the New value of the observation containes the full json of the reasoner
      • the Old value of the observation is empty (for performance reasons, given that it is not used in the edge logic)
  • The resource is a thing instance contained in the bridgeInstances property of a bridge. Crud for the instances are sent to the topic amtech/things/eventsources/amtechM2mBridge/<bridgeId>/crud
  • The resource is a thing of a type configured to send crud observations in at least one activity
    • for creators, all activities he has created are analyzed
    • for followers, all activities he is subscribed to are analyzed

Notes :

  • The resource must have a valid status (not draft), otherwise the crud is not sent
  • The CRUD observations are sent to the topic /crud/<thingType> example "topic": "/crud/endCustomer"
  • For things of type AmtechM2mBridge, the CRUD observation of a DELETE operation is not generated (for consistency with the logic that the deletion of a bridge deletes the topic /amtechM2mBridge where the crud observations for the bridge and its instances are)
  • Crud observations are only sent if the value of a property changes
    • For properties of type collection such as the guest tenant or guest users, the content of the list is analyzed to determine if it changed. So an update of guest tenants [tenant1, tenant2] to [tenant2, tenant1] will not generate a crud observation.
  • When creating things with a topology execution using a reasoner, are created via a PUT operation with the parameter createIfNotExist=true, so the crud observation generated will have the operation PUT