cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Subscription with dynamic thing

Highlighted
Level 8

Creating Subscription with dynamic thing

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.gateway subscription.PNG

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.

 

Any advice appreciated.

2 REPLIES

Re: Creating Subscription with dynamic thing

AddDynamicSubscription/RemoveDynamicSubscription can 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.

Re: Creating Subscription with dynamic thing

Hi @aseaton.

 

If the response provided by @posipova resolved your issue, please mark it as the Accepted Solution for the benefit of others with similar questions.

 

Regards.

 

--Sharon