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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Run Service Programmatically.

vr-6
4-Participant

Run Service Programmatically.

Hi,

I have 4 service in my thing template. The Problem is service runs when I open the Mashup. In Background services are not running. Thanks in advance

Regards,

Vel

4 REPLIES 4
Aanjan
9-Granite
(To:vr-6)

Velkumar, as long as the service is not bound to the 'Mashup Loaded' event, nothing should load upon startup. You can check this by clicking on the 'Workspace' tab at the Mashup builder stage, then click on 'Mashup' and view the bottom pane. That should display all services set up to run on Mashup load.

ankigupta
5-Regular Member
(To:vr-6)

Hi Velkumar R​, As Aanjan mentioned this is expected behavior based on your implementation.

Generally if you want to run services in the background then you need to create subscription to some event and call your service in the subscription code.

For example if you want to run a service every one hour then you can create a timer event using Timer thing and subscribe to this event and call your service.

vr-6
4-Participant
(To:ankigupta)

Hi Ankit,

Thanks for your help. I don't want to run my service based on time, but I want to run other service in background when values of main service changed. Can you tell me how to create subscription to datachange event and to run service in background.

Regards,

Vel

supandey
19-Tanzanite
(To:vr-6)

Hi Velkumar, here's what you need :

Navigate to ThingTemplate/Thing for which you want to create subscription

1. Click on Subscriptions under Entity Information in the left panel

2. Click Add My Subscription

3. Select the Event as you can see in the screenshot below like for .e.g DataChange

4. Once you select the DataChange you'll be asked for the Property on which the DataChange event must fire

5. Finally, in the script section over the right you can either write your script or can call an already existing service

Hope this helps.

Top Tags