Skip to main content
15-Moonstone
March 4, 2022
Solved

Parallel execution and combine results

  • March 4, 2022
  • 1 reply
  • 2033 views

Hello,

I have 10 things(eg.) which has a common service called fun1() which outputs Infotable as result by making an external API call.

I would like to union the infotable results from all the 10things fun1() call finally.

Instead of looping through each thing and waiting for the output, I would like to run them in parallel as the output is independent of each other and finally once we get the result of all i have to union them to give one result.

 

What is the best approach in Thingworx. 

 

Thank You!!

 

Best answer by slangley

Hi @sbt.

 

There are a lot of unknowns regarding your use case, efficiency, performance, etc. so it's difficult to make a recommendation.  This scenario would best be handled by one of our global services consultants.  You can engage with them through the Sales team.

 

Regards.

 

--Sharon

 

 

 

1 reply

22-Sapphire I
March 4, 2022

You could do it by having each of those services set some value in a property besides perhaps placing the retrieved value in another property.

Then have a property data change event into a subscription to evaluate if all services finished to then pick up and stitch the final output together.

This does mean it is happening asynch and you have to use something else then to pick up the final output.

sbt15-MoonstoneAuthor
15-Moonstone
March 4, 2022

Since the no. of things which is going to call the API is dynamic, meaning it can go to more than 20 too sometimes. And the results(Infotable) have to combined and shown on a grid on the button event from the mashup. 

Imagine like user can select 10or20 but the output is one infotable.

So here setting property would not be ideal right.??

 

 

22-Sapphire I
March 4, 2022

Is there no way to know how many calls will be made? Because if you know you can always retain that number for that particular call and use that to gauge if the calls have finished.

After that potentially with yet another data change and a getproperties - push on update - mashup parameter - mashup parameter changed event - retrieve final value could be possible.