Difference between revisions of "CRUD observations"

From AMTech WikiDocs
Jump to: navigation, search
 
(34 intermediate revisions by the same user not shown)
Line 1: Line 1:
Crud observations are produced when a thing type is created, updated or deleted
+
Crud observations are produced when a thing instance is created, updated or deleted.
* the observations is sent if:
+
 
** the thing type produces CRUD or if the activity has the thing type in the list of CRUD producers.  
+
* The thing type must be configured as a Crud Producer in an activity. Crud Observations are then sent to the topic /observationresourcecrud/<thingType>/<thingId>/<crudOperation>/<propId>
** the thing instance has a valid status (not draft)
+
**Ex. topic used when deleting instance : tenant1/observationresourcecrud/type1/thing1/delete
* The CRUD observations are sent to the topic /crud/<thingType> example "topic": "/crud/endCustomer"
+
**Ex. topic used when updating property description of an instance : tenant1/observationresourcecrud/type1/thing1/put/description
* For Followers, crud observations are sent only if the follower is an admin
+
** Topic used when creating new instance : tenant1/observationresourcecrud/type1/thing1/post
* 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 sent for all users (creator, admin follower, and invited follower)
* Crud observations are only sent if the value of a property change. If the same value is updated, the crud is not sent. For properties of type collection such as the guest tenant or guest users, the content of the list if analyzed to determine if it changed. So an update of guest tenants [tenant1, tenant2] to [tenant2, tenant1] will not generate a crud observation.
+
* When looking for the crud producers configured in the activities the user has :
 +
** 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
 +
* 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
 
* 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
* When deleting multiple things at the same time via the platform UI, crud observations are not sent. They are only sent when deleting one resource at a time.
+
 
* DELETE of bridges won't generate crud observations
+
''' Internal crud observations for bridges and smart types '''
 +
* For bridges and its instances, an internal crud observation is sent (to be used from the bridge edge logic ). Topic is _bridge/<tenantId>/observationresourcecrud/amtechM2mBridge/<bridgeId>/_all/<propId> ,ex. _bridge/amtechdemofollower/observationresourcecrud/amtechM2mBridge/b122/_all/sc
 +
* For Things of a smart type(stg, stpg) internal crud observations (newdt and comp) are sent (to be used from the smart type devices)
 +
** Topic for new digital twin created : _newdt/<tenantId>/<typeId>/<thingId> , ex. _newdt/amtechdemofollower/stg/stg555
 +
** Topic for crud observations with reduced payload : _comp/<tenant>/observationresourcecrud/<typeId>/<thingId>/<operation>/<propertyId> , ex. _comp/amtechdemofollower/observationresourcecrud/stpg/stpg_F5C1F8/put/sc
 +
* These internal crud observations for bridges and smart types are only sent for Followers
 +
''' Bridge crud for edge logic '''
 +
* For things of type AmtechM2mBridge, resources contained in a bridge, and for things linked to a bridge via the bridgeInstances property, crud observations are always generated and sent to the topic /<typeId>/<instanceId>/crud ex./amtechM2mBridge/bridge1/crud (to be used by the edge logic). Observations are sent to this topic for all instances of these types, even if they are not configured as crud producers in any activity.
 +
**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 contains 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)

Latest revision as of 10:50, 28 January 2021

Crud observations are produced when a thing instance is created, updated or deleted.

  • The thing type must be configured as a Crud Producer in an activity. Crud Observations are then sent to the topic /observationresourcecrud/<thingType>/<thingId>/<crudOperation>/<propId>
    • Ex. topic used when deleting instance : tenant1/observationresourcecrud/type1/thing1/delete
    • Ex. topic used when updating property description of an instance : tenant1/observationresourcecrud/type1/thing1/put/description
    • Topic used when creating new instance : tenant1/observationresourcecrud/type1/thing1/post
  • Crud observations are sent for all users (creator, admin follower, and invited follower)
  • When looking for the crud producers configured in the activities the user has :
    • 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
  • 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

Internal crud observations for bridges and smart types

  • For bridges and its instances, an internal crud observation is sent (to be used from the bridge edge logic ). Topic is _bridge/<tenantId>/observationresourcecrud/amtechM2mBridge/<bridgeId>/_all/<propId> ,ex. _bridge/amtechdemofollower/observationresourcecrud/amtechM2mBridge/b122/_all/sc
  • For Things of a smart type(stg, stpg) internal crud observations (newdt and comp) are sent (to be used from the smart type devices)
    • Topic for new digital twin created : _newdt/<tenantId>/<typeId>/<thingId> , ex. _newdt/amtechdemofollower/stg/stg555
    • Topic for crud observations with reduced payload : _comp/<tenant>/observationresourcecrud/<typeId>/<thingId>/<operation>/<propertyId> , ex. _comp/amtechdemofollower/observationresourcecrud/stpg/stpg_F5C1F8/put/sc
  • These internal crud observations for bridges and smart types are only sent for Followers

Bridge crud for edge logic

  • For things of type AmtechM2mBridge, resources contained in a bridge, and for things linked to a bridge via the bridgeInstances property, crud observations are always generated and sent to the topic /<typeId>/<instanceId>/crud ex./amtechM2mBridge/bridge1/crud (to be used by the edge logic). Observations are sent to this topic for all instances of these types, even if they are not configured as crud producers in any activity.
    • 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 contains 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)