Sending a timestamped object to that exact time

0
We are trying to do a test for one week long. 24/7 The idea is that we send files out of Mendix and gain a response and we measure the time difference from leaving Mendix and returning to Mendix. In the data there is a time stamp on each object, to the second, that the file must be passed out at that time. Is there a way of sending each object to out to the exact time stamp in that object?
asked
4 answers
0

I guess when you are sending these objects you send them as a JSON object? I would suggest that when you execute the microflow that sends this object, you set the time to the %CurrentDateTime% (https://docs.mendix.com/refguide/datetime-handling-faq). This should set the timestamp to the current Unix timestamp (which is, if I'm correct, down to the millisecond). The time difference between setting that timestamp and sending it out should be negligible.

answered
0

Hi

Yes the object has an attribute (Send Time) which has the time in it that we need send the object.

The object needs to be sent at that exact time.

Thanks

answered
0

A naive implementation could be:

  • Retrieve batches of objects (say, 100 at a time), sorted on ascending SendTime,
  • Loop over the objects,
  • Calculate the difference between now (CurrentDateTime) and SendTime,
  • Use the Delay Java action from CommunityCommons for the calculated difference
  • Send the object

 

The time might not be exact, due to conversion from object to JSON, time required to set up the connection etc, but it should be close enough. You can play around with the Delay timing, or you could create the request before you start delaying.

 

[Update]

Based on the volume, I would use a queue module from the appstore. The basic setup remains the same:

  • Create a queue with a number of threads with the maximum number of documents you want to send in a 2-3 second interval
  • Retrieve batches of objects (say, 100 at a time), sorted on ascending SendTime,
  • Loop over the objects,
  • Calculate the difference between now (CurrentDateTime) and SendTime,
  • Use the Delay Java action from CommunityCommons for the calculated difference
  • Add the object to the queue (you may need to end the transaction here, using the EndTransaction Java action from CommunityCommons)
  • The queue will pick up your object and send it, roughly at the expected time
answered
0

Could this lock the system up?

We could have 27 a second going at the most.

 

answered