23
Views
7
Comments
Solved
Does Looping Action in a Job will terminate when the job is stopped?
Application Type
Traditional Web
Service Studio Version
11.9.1 (Build 33435)
Platform Version
11.10.0.23028

Hi there,

I have an action that will be looping forever.

I put that action in a Job. My question is whether that action will terminate when i stop the job?

Regards and thanks

mvp_badge
MVP
Rank: #2
Solution

Hi Ibox,

First, there's no such thing as "jobs" in OutSystems. There are Timers and there's BPT Automatic Activities, but "jobs" is not OutSystems terminology. Secondly, neither Timers nor Automatic Activities can be manually stopped. So saying "when I stop the job" is not something that makes sense in the context of OutSystems.

Finally, you cannot have Actions that loop forever. That is, you could create them, but IIS (assuming it's a Server Action) will kill them off after a time-out period. So your question really doesn't make sense.

Rank: #223

Thank you Sir,

I mean Timers. Here is my case: I create an extension to consume  Kafka Confluence message in Java, the pseudo code is like this:

while(true){

msg = consumer.poll(5 minutes);

ProcessMessage(msg);

}

What should I do to run this forever polling?

Thank you and best regards,

ibox

Rank: #223

Ok, i think it is using infinite timers. Tq

mvp_badge
MVP
Rank: #2

Hi IBox,

There's no such thing as "infinite timers" in OutSystems. OutSystems Timers run for a set maximum amount of time (configurable per Timer), after which the Timer is terminated. Long polling, which seems what Confluence is offering, is something ill-suited for OutSystems Timers (or OutSystems in general, tbh). The best you can do to simulate it, is either have a Timer run for e.g. 5 minutes, like the while loop in Java, then restart itself, or use BPT to the same effect (which may have lower latency).

Rank: #493

Agreed. So that the loop will end when you stop the timer

mvp_badge
MVP
Rank: #2

No, that's wrong. The loop will not end, the loop will be terminated. And you cannot stop a Timer, a Timer is forceably terminated if it runs longer than its alloted time.

Rank: #223

Thank you, Sir,

For simulate the ever lasting timer, i see in here: https://www.outsystems.com/learn/lesson/1133/master-class-on-best-practices-and-timers. But, as you tell, it is better to use BPT - i can terminate the polling by setting the while condition to false using this BPT, instead of trying to use Ctrl-C to terminate it and i don't know how we can send signal like that in Outsystems.

First, i think to try timer and run it on publish, but as you say that it will be kicked by the IIS - i never try it -, i think i'll forget the timer on publish.

Confluence take some feature about times, and BPT is also not that suitable for real time event streaming (auto activity has constraint 5 minutes). However, as we want the module in Outsystems and i think for update master table does not take more than 5 minutes, it is best choice.

thank you and best regards