4 Replies Latest reply on Dec 7, 2016 9:22 AM by supandey RSS
    vr-2 Explorer

    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

      • Re: Run Service Programmatically.
        aanjan Heavyweight Champ

        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.

        • Re: Run Service Programmatically.
          Ankit Gupta Ninja

          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.

            • Re: Run Service Programmatically.
              vr-2 Explorer

              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

                • Re: Run Service Programmatically.
                  supandey Collaborator

                  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.