Synchronously uploading and processing data sometimes leads to a timeout. Nothing happens for a while after uploading the data file, and eventually, the application times out. If not appropriately dealt with, timeouts can result in incomplete or duplicated data in the database.
Fig 1. Timeout due to large data file uploaded and synchronously processed.
This how-to scenario presumes that we have:
In the end, we will also have:
We could solve this using different approaches, but let’s see how to use light BPT to process large amounts of data.
First, we use an entity to store the uploaded data precisely as it comes from the excel file: RawData. The records will be created synchronously after the user uploads the file and clicks the button on the screen.
Then, each record will be processed and stored in the Customer and the Contract entities according to the process requirements.
Fig 2. Used entities: RawData, Customer and Contract.
The way data is processed is defined in a server action (Fig. 3), similar to the one we would use in the synchronous version of this functionality. This action receives the RawData record identifier, creates the customer, then its contracts, and finally deletes the RawData record.
This action will be used inside the only Automatic Activity node that this process can have, in order to be executed as a light process.
Fig 3. Server action to use in the process Automatic Activity flow. It processes one customer.
To create the process:
Fig 4. Right-click the processes folder to create a new process.
Fig 5. Fill in the Name and Detail properties of the process.
Fig 6. Set the Launch On property of the process to CreateRawData entity action.
Fig 7. Drag and drop an Automatic Activity node into the process flow and name it ProcessOneCustomer.
Fig 8. Drag and drop the server action into the Automatic Activity flow.
After publishing, open the screen, upload the excel file and check if the processed data was created.
Remember, to activate light BPT execution in OutSystems, head over to the Service Center and enable the execution of lightweight BPT by ticking the respective checkbox and clicking apply.
Fig 9. Check the light process execution checkbox, in Service Center, to enable it.
Have fun building light BPT!
A “normal” Process, also known as BPT (Business Process Technology), allows implementing a flow of activities to be executed at specific moments either automatically or by user interaction, depending on how it’s implemented. Each activity for each process instance is tracked in the database unless it is executed as a light process.
When we enable light BPT execution, there’s a trade of advantages and disadvantages that allow processes that don’t need tracking to run much faster, which increases the number of processes that can be executed simultaneously from a default of 10 to 20 concurrent threads per front-end.
To benefit from light BPT execution:
You can learn more about processes by checking out some of my favorite articles on the subject:
To see these tips in action, check out our Tech Bites video on our website on How to process data with Light BPM, published earlier.
Have you heard about the OutSystems Developer Cloud and want to know more about what's new and what the big benefits are? Then this article is for you!
When including forms in applications, developers often wonder if they need to re-validate data on the server side after having checked it on the client. Why go to the trouble of checking the data twice?
When developing an OutSystems reactive web app, you would expect to display data quickly, but it doesn't always happen. Do you know why? We'll explore the reasons and how to tackle them.