Timer Poll 1 Second Intervals

  
Hi Guys,

I Have a situation in which I need to poll a web service every time that the current action is completed.



Here is a screenshot of the timer in Service Centre:


However, it does not seem to be running unless I have the application open and I click on a button to poll.

How can I have this timer excecute the action on the server every time that it finishes??

Kind Regards
FC Malan


You can use the WakeTimer inside the Timer Action. But I would revise this logic. This means you'll have a process consuming CPU resources all the time...
André Vieira wrote:
You can use the WakeTimer inside the Timer Action. But I would revise this logic. This means you'll have a process consuming CPU resources all the time...
 Hi Andre,

I am currently using the Wake Timer inside the Timer Action (See last action in above image). It does not seem to work that well though?

Also, yes I agree that it is consuming CPU resources all the time. But this is for our Phone System so we need to have a record of Call Activity at all times. Do you have any suggestions on what would work better?

Thanks
FC Malan
 
I'm assuming you can have your Phone System reaching your application in any other way, is that it?
I've implemented some integrations in the past with telephony systems and when a call was pickup by the operator that system would be able to open a page from an outsystems application passing the necessary data...
Yes, we are using the 3CX phone system and for us to be aware of what's happening on the server we had to create an extension that communicates with a WCF service exposed by a windows service and then returns data to us by polling with the timer.

Do you know of a way that I can check to see if the timer is running or if it has stopped?

Thanks for the suggestion I will look into it as well.


Hello Ferdinand

Regarding your pooling approach and requirements, Waking up the timer will not get you the 1 second pooling intervals you seek, because the OutSystems Scheduler pooling is 20 seconds interval. This means that your timer will only run once every 20 seconds at most.

As for the pooling approach in general, depending on the load and number of requests, it may cause exaustion of resources (threads, or even ephemeral TCP/IP ports).

If you have no alternative using callback events or requests (like André Vieira referred), then you need to adopt a different approach to the pooling:

1. If the pooling total time lapse is within minutes, you can call the WCF service, and keep pooling for the result in loop with 1 second sleeps, all within the timer.

2. Instead of timers, use BPT Process, and use the Wait with a timeout of CurrDateTime()+1 second, and on the On Close action of the Wait, you pool the phone system. BPT has much shorter pooling intervals in the Scheduler (1.5 seconds). As long as there are threads in the BPT Engine to process the activity, it will execute with a 1.5 seconds interval.

Keep in mind that pooling wiht such short time intervals is not recommended, as it exausts resources, and simle isn't a scalable solution.

Hope this information is helpful.

Cheers


Offering some constructive criticism, one thing you could do to avoid polling is having a callback mechanism.

Instead of having the Platform constantly polling for new messages, you can add a web service on the platform which the other system calls whenever a new message / call arrives.

Hope this helps.
Miguel João wrote:
Hello Ferdinand

Regarding your pooling approach and requirements, Waking up the timer will not get you the 1 second pooling intervals you seek, because the OutSystems Scheduler pooling is 20 seconds interval. This means that your timer will only run once every 20 seconds at most.

As for the pooling approach in general, depending on the load and number of requests, it may cause exaustion of resources (threads, or even ephemeral TCP/IP ports).

If you have no alternative using callback events or requests (like André Vieira referred), then you need to adopt a different approach to the pooling:

1. If the pooling total time lapse is within minutes, you can call the WCF service, and keep pooling for the result in loop with 1 second sleeps, all within the timer.

2. Instead of timers, use BPT Process, and use the Wait with a timeout of CurrDateTime()+1 second, and on the On Close action of the Wait, you pool the phone system. BPT has much shorter pooling intervals in the Scheduler (1.5 seconds). As long as there are threads in the BPT Engine to process the activity, it will execute with a 1.5 seconds interval.

Keep in mind that pooling wiht such short time intervals is not recommended, as it exausts resources, and simle isn't a scalable solution.

Hope this information is helpful.

Cheers

 
 Hi Miguel,

Thanks for the sollutions.

I am sorry but I am still very new to the Outsystems Platform.

How would I go about implimenting sollution one? Do you maybe have an example of this functionality?

As for sollution two, we have someone here that deals with the BPT Process but I have no idea of how it works in practice.

Thanks for all the help.

Kind regards
FC Malan
 
Ricardo Silva wrote:
Offering some constructive criticism, one thing you could do to avoid polling is having a callback mechanism.

Instead of having the Platform constantly polling for new messages, you can add a web service on the platform which the other system calls whenever a new message / call arrives.

Hope this helps.
 Hi Ricardo,

Thanks a lot for the suggestion.

As stated in reply to Miguel's post. I am still very new to this platform.

How would I go about implimenting a callback mechanism?

Thanks in advance.
FC Malan
 
Hi Guys,

Thanks for all the input and help.

I have figgured out what you meant and it is working well now.

Thanks again for all the help and suggestions.
Hello

Sorry for not checking in sooner ... I can see that you've figured out and overcome the problem.

Good to know.

Cheers