Is there any way to execute "stack" actions
Question

Hi,

We are finding the need to execute certain actions in a correlative way (which does not mean synchronously).

For example, I need users to receive a complex file to prepare, in the mail, each time they request it. Since the generation of the file already supposes a time x we are doing it with a timer:

- We create the request for the file in the database and call a timer that prepares the file and sends it by mail.

The problem comes when several users request the file at the same time. We do not know how to solve it and we miss something type stack in outsystems...

Is there an option of not knowing?

We had thought about the BPTs but we see that the timeout is 3-5 minutes ...

The most important thing here is that a timer cannot be executed more than once at the same time. So you don't need to worry that your temporary report table gets cleared by a second request.

What I would do, is keep the current logic. Trigger the timer when a user requests a report and at the end of the code of your timer, go check your request table to see if there are any new requests to be handled. If so, call the wakeTimer again, to restart the timer. (I would restart it, because you say the report takes 10 mins and the default timeout is 20 mins, so 2 reports is too much a risk)

Hi, 


My first question is: What is the problem when several users request the file at the same time? A timer can just generate the file 2 times for each recipient. 

You just have to create a record in an entity that a file needs to be generated to be sent to a recipient. 

That could be with a timer, or when you can ensure you don't hit the timeout of 3 minutes (so check if you can decompose the file generation) using Light BPT.

Regards Hans

Yes, but I can't fill in records in the database and that according to what is created, the timer collects them and prepares the file and sends it to each request.

I understand that for this I would need a third-party integration like kafka ...

perhaps I don't understand the flow and problem fully. You might try to explain it to me :). Which steps does the user need to take in order to accomplish which goal?

It is more likely that I am not explaining myself ...

The specific case that I have now is that the user requests a report. The report is expensive to get (it takes up to 10 min), so we have solved it by creating an entity where we save the request for the report and launch a timer that prepares the report and sends it by mail to the user who has requested it.

The problem comes when several users request the report at the same time. The timer is already busy working on the first request and, to date, we directly do not allow it to be requested again until the timer ends the execution (we disable the button).

We'd like to change this so that multiple users can request the report at the same time, but I can't use BPT or BPT light because of the timeout, can you think of a way to handle these requests as a stack?

Hi CrisSanz,

your problem is that you block extra requests when the timer is running.  Why is that ?

I think you can allow as many requests at the same time as your users would like to make, all ending up as a record in your 'request' entity, and at every request you wake the timer.

The timer picks up the next available request and processes it, updating it's status or deleting it from the request entity.  And just keeps processing requests as long as there are any in the entity until it gets near its timeout, then if more requests are there, wakes itself up and ends processing.

Something like that.

Dorine

The most important thing here is that a timer cannot be executed more than once at the same time. So you don't need to worry that your temporary report table gets cleared by a second request.

What I would do, is keep the current logic. Trigger the timer when a user requests a report and at the end of the code of your timer, go check your request table to see if there are any new requests to be handled. If so, call the wakeTimer again, to restart the timer. (I would restart it, because you say the report takes 10 mins and the default timeout is 20 mins, so 2 reports is too much a risk)

Thanks, it seems like a good solution for what we need

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.