Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hi,
I am creating a service that fetches data from an external api with subsequent actions that needs to be run in a certain order. As an api call needs to finish, I wonder how to run code asyncroniously in a thingworx service?
I tried to write an async function, but I got the error in the image bellow, writing use 'esversion: 8' did not work.
Solved! Go to Solution.
Will running the service itself as async will not work for you? From the service, you can either use property set event or event subscription to trigger other processes. If the other stuffs are not heavy/long you can probably put to same service.
As of now you can't use it. TWX uses Rhino 1.7,11 (or so) and does not allow for the async feature. https://mozilla.github.io/rhino/compat/engines.html
Alternatives are Web hooks with the other system pushing the result into Thingworx or that you are polling regularly for the result with a request key.
From what you are saying, perhaps you can use the end of the API call to invoke an event/subscription to then start the next set of services.
Will running the service itself as async will not work for you? From the service, you can either use property set event or event subscription to trigger other processes. If the other stuffs are not heavy/long you can probably put to same service.