3 Replies Latest reply on Nov 18, 2014 10:15 PM by paic RSS
    lorenmc Explorer

    AddStreamEntry function call timing

    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



      • AddStreamEntry function call timing
        paic Collaborator

        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.

         

          • AddStreamEntry function call timing
            lorenmc Explorer

            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?