Skip to main content
1-Visitor
November 18, 2014
Question

AddStreamEntry function call timing

  • November 18, 2014
  • 1 reply
  • 1424 views

Will the function call 


Things["MyDataStream"].AddStreamEntry(params);


wait until all data has been added to the stream before returning back to the script which called it? 


In other words, if I need to make that function call repeatedly, let's say in a for loop, do I somehow have to manage the timing of everything so that all data will be added to the stream before I call the function again?


Please advise.


Thanks


Loren



    1 reply

    1-Visitor
    November 18, 2014

    Hi Loren, not sure if you remember. But Streams are asynchronous. So you can call the Add stream function as many times as you want and they will just be handled. But if you need to immediately use the information from the stream, you have to be careful with timing issues.

    lorenmc1-VisitorAuthor
    1-Visitor
    November 18, 2014

    Hi Pai,

    Thanks for the quick reply.


    I seem to be having issues where data is not getting into the stream as I expect.  Sometimes it works and sometimes it doesn't.  The first few calls to AddStreamEntry seem to always work but the calls that occur in the later iterations of the loop seem to have issues.  Running the service on different ThingWorx machines also gives me different results.  Also, the more entries the Stream has the more issues I seem to have.


    Any ideas for debugging?



    1-Visitor
    November 19, 2014

    Hi Loren, I recommend you open up a case with technical support.