I have a requirement to notify the gateway (remote) thing of the asset whenever there is a new dispatch schedule available. The easiest way to achieve this I think is to add a subscription on the gateway (remote) thing that listens to the Modify event of the dispatch schedule data table. The issue I have is that I want to add the subscription to the gateway (remote) ThingTemplate and therefore make it generic – but when making a subscription we need to define the source thing – in this case the dispatch schedule data table…but this changes depending on the asset.
Example shown in attached media.
The source in this example is 7bec84e9-93d8-482e-9910-186b67ebd81bDispatchSchedulePhysical and all I’m doing in the script is telling the gateway that there is a new schedule available to be retrieved. I’ve had a look at adding the subscription dynamically, but I’m not sure this is the solution.
AddDynamicSubscription/RemoveDynamicSubscriptioncan be used to add/remove subscriptions. However, the subscription added by AddDynamicSubscription are in-memory only, meaning not only they will not show up in composer at all, these Dynamic Subscription will be gone with a Thing restart.