In oneM2M, all the resources created on MN-CSE node are stored in the database on the node itself. I also want to notify IN-CSE of the new resources that are created on the MN-CSE and save them in the datatbase there. How can I achieve this?
My approach - currently, I am thinking of creating a subscription for each resource with IN-CSE address as the notificationURL. So that as soon as a new child resource is created for a resource, IN-CSE will be notified and IN-CSE will parse the notification and save the information in the database. Is the approach correct?
Thanks in advance :)
While you can have an AE running on the IN-CSE that will do the duplication of resources with the method you described (the notification target would be that AE), it would be better to make use of announced resources. This is the specified way to achieve what you want.
To announce a resource you assign the CSE's csi to that resource's at (announceTo) attribute. If the target CSE is reachable then this will automatically announce the resource and all mandatory announced attributes to that target CSE. If you also want other optionally announced attributes to be announced then you need to specify them in the aa (announcedAttribute) attribute. Please also note that attributes marked as "not announced" in the spec cannot be announced across CSEs.
An announced resource is updated automatically by the Hosting CSE of the original resource whenever the original resource changes. The announced resource contains a link to the original resource.
For more details you might have a look at TS-0001, clause 9.2.3 "Announced Resources".