Pass parameters when calling "Wake Timer"
3638
Views
24
Comments
On our RadarOn our Radar
Backend
Since "Wake Timer" can be called via code, it would be good to be able to pass paramters to it.

J.Ja
Agreed. I also have a situation where i would need to pass arguments to the timer.
Have you found a workaround?
Joao -

Yes, you make an entity representing the parameters, and the timer queries it, processes based on the saved parameters, and deletes the record when it is done. It is not ideal, but it works.

J.Ja
Wake Timer action doesn´t accept input parameters. It was nice if we can input information inside a timer.

Merged from 'Possibility to add input parameters in Wake Timer action' (idea created on 2010-06-07 12:23:49 by Fernando Santos), on 2016-10-25 08:28:16 by Goncalo Borrega
I had the same feeling the other day when I had to use a WakeTimer, but since calling the WakeTimer multiple times does not mean it will run more than once (if its really fast) this is not really an option.

Instead of asking for inputs for WakeTimers to simulate that behavior maybe it should be a feature request for built-in asynchronous action calls.


Merged from 'Possibility to add input parameters in Wake Timer action' (idea created on 2010-06-07 12:23:49 by Fernando Santos), on 2016-10-25 08:28:16 by Goncalo Borrega

That's a better approach! And it could make apps multi-treading!


Merged from 'Possibility to add input parameters in Wake Timer action' (idea created on 2010-06-07 12:23:49 by Fernando Santos), on 2016-10-25 08:28:16 by Goncalo Borrega

I agree with João's suggestion!


Merged from 'Possibility to add input parameters in Wake Timer action' (idea created on 2010-06-07 12:23:49 by Fernando Santos), on 2016-10-25 08:28:16 by Goncalo Borrega
2016-11-21 23-23-05
Gonçalo Borrêga
Merged this idea with 'Possibility to add input parameters in Wake Timer action' (created on 2010-06-07 12:23:49 by Fernando Santos)

It would really be very interesting!

This is what we need for our apps! In some occasions we're using synchronous calls since we can't pass any parameters to timers. Which is a waste of the users time! What's the status of this idea?!

You can do this, however you must use a Site Property for Input


Action

Timer

Call Logic



Hey Heryck,

If you use site properties in that manner, you run the risk of missing one in case there are concurrent requests that would wake the timer.  You cannot guarantee that the site property will not be overwritten prior to the timer waking.

I would recommend using a table to keep the ids and then querying that in the timer to avoid this possible issue.

In my logic I did a check if the Timer is already running, and if so, it returns a message to the user, I also put a check to be able to call the functionality only after one minute of the last call.

But you can do this control with a table too, but it would not be passed by input, and if it were, you would probably have to do the same valuations above


Thanks for your comment.

Never, ever, ever use site properies like this! Site properties should be considered immutable as far as the application is concerned! Updating them like this may cause serious performance and synchronisation problems.

Merged this idea with 'Wake "Timer" action should accept same input parameters as its service action inside the timer' (created on 19 Feb 2020 01:04:22 by Ravi Vakkalanka)

If we create a timer which executes a Service Action with some input parameters then Wake<Timer> action should also accepts the same input parameters so that the timer can be called asynchronously from a web flow.

Currently Wake<Timer> action does not accept input parameters Version 11



This comment was:
- originally posted on idea 'Wake "Timer" action should accept same input parameters as its service action inside the timer' (created on 19 Feb 2020 by Ravi Vakkalanka)
- merged to idea 'Pass parameters when calling "Wake Timer"' on 13 Sep 2021 19:49:44 by Daniël Kuhlmann

Hello, Ravi.


If you might want to try to other asynchronous patterns and see if they better fit your goal.


https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Processes_(BPT)


https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Processes_(BPT)/Design_Scalable_Database_Queueing_Using_Light_Processes


You might be able to achieve what you want with a Light BPT.


Anyway, if you really need to pass inputs for your timer (I often do), you can create an Entity, something like MyProcessInput, and create the inputs in a record. You call a CommitTransaction and then wake your timer. Your timer should pickup the top record from the MyProcessInput and delete it so no other timer instance picks it up again.


Best,

Tiago



This comment was:
- originally posted on idea 'Wake "Timer" action should accept same input parameters as its service action inside the timer' (created on 19 Feb 2020 by Ravi Vakkalanka)
- merged to idea 'Pass parameters when calling "Wake Timer"' on 13 Sep 2021 19:49:44 by Daniël Kuhlmann
Changed the category to
Service Studio


This comment was:
- originally posted on idea 'Wake "Timer" action should accept same input parameters as its service action inside the timer' (created on 19 Feb 2020 by Ravi Vakkalanka)
- merged to idea 'Pass parameters when calling "Wake Timer"' on 13 Sep 2021 19:49:44 by Daniël Kuhlmann

Hopefully this will be released soon as this will make batch processing with timeout management easier like passing the next starting index to process.

Absolutely needed. Wander why it is not implemented yet. It has been asked 10 year ago.

@Bad Code Guru the reason has been given by João Rosado, 14 years ago:

"I had the same feeling the other day when I had to use a WakeTimer, but since calling the WakeTimer multiple times does not mean it will run more than once (if its really fast) this is not really an option."

The thing is that unless you know whether the timer is running or not, and you have intimate knowledge on how timers are scheduled (as described in my artikel here), you can't be sure that there will be a timer run with that specific parameter that will actually run.

@Bad Code Guru part of this tread (the 14 years one that got merged into it and has my reply)  was before the platform had BPT's, currently what I said as the better alternative that would be a "feature request" is already implemented in the form of Processes and especially more recently with Light Processes.

So while this idea itself is not implemented (and will most likely never will), there are far better alternatives.

Hi @Kilian Hekhuis @João Rosado 

I some particular cases I need to use timers inside BPT.

BPT is triggered by db record created, where I can store any metadata information I need to do inside the process. In that sense you both absolutely right. But a BPT and timer are similar, but has different logical concept. 

Example: Let's say I have BPT "World creation". As a god I have static Entity {Animal} with Animals I want to create. Inside my divine BPT I loop thru {Animal} and call Action Animal_Create(AnimalId)

But animal creation is an expensive action, and I decided to create a timer with this action that can handle timeouts and re-execute itself. 

I know you can argue (we all argue with gods) I can create sub-BPT to handle creation of an Animal with AnimalId, but I want to keep logical concept of BPT and timers, and moreover BPT amount is limited, and I want to create a lot.., not just Animals.

I hope now you understand why I bolded my wonder why it is not implemented.

Thanks.

Is there any alternative for it to download the data asynchronsally by passing parameteres ?

Hi Ajit,

Please don't ask questions in the Idea section. Create a question in the forum instead.