47
Views
1
Comments
Rest API, timer
Application Type
Reactive

Hello everyone,

Suppose 3 user has logged in into a same application. First user click the button and API start running, at the same time second user hits the button and trying to process the flow and same the third user tries. 

So my question is that, if first user clicks the button and API is running at the same time if second and third user clicks the button then there request will on queue  and a message will be appear. After that when first request completed then second user's request automatically run, and third users request will be on queue  (on waiting).

Is there any way to achieve this type of scenario in OutSystems.

Thanks,

Rakhi

2024-12-10 04-40-04
Gitansh Anand

HI @Rakhi Chouhan, I have not done this, so there might be a better solution available, but here is an idea. For this idea, apart from all your entities and logic, you will have to make two more entities and two more processes. From the two entities, one will be for queue and one will be for completed. Here are the steps:

1. When someone hits your API, make an entry in the queue table and store all the inputs in that table.
2. The first process will automatically launch on create of queue table; for this, use the "Launch On" property of the process.
3. Inside this process, check how many entries are in the queue table; if there is only one entry, launch the second process; otherwise, end the flow.
4. The second process should also launch on create of completed table.
5. Inside the second process, first fetch one record from the queue table using ascending sorting on the created date time. If there are no rows in the queue table, then end the flow; otherwise, run your required logic, delete the currently fetched record from the queue table, and make an entry in the completed table.

Thanks
Gitansh Anand

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