Synchronously uploading and processing data sometimes leads to a timeout, as we see in the following scenario.
After uploading the file, nothing happens for a while, and eventually, the application times out. We could solve this using different approaches, but we will show how to use Light BPT to process large amounts of data in this video.
To implement this solution, we use an entity to store the uploaded data precisely as it comes from the excel file; we call it raw data. The records will be created synchronously after the user uploads the file and clicks the button.
Then, when the data is processed, it will be stored in the Customer and the Contract entities according to the process requirements.
The way data is processed is defined in a server action similar to the one used in the synchronous version. This action receives the raw data, creates the customer, and then its contracts, and in the end, deletes the raw data.
So let’s create the process: In the Processes layer, create a new process, name it and provide a “detailed” description.
After that, the Launch On property needs to be set: this is where we define what wakes up the process, which means that every time a new customer is created in the Raw Data entity, this process will be executed.
Inside the process, we will use an automatic activity. Double-click it to implement it just like any other OutSystems action.
Inside we will use the previously created server action to process one customer’s raw data.
Notice that the Raw data identifier is passed to this action by the process. The process has access to that Id since creating a raw record triggers it.
Let’s publish and test it.
Awesome, it’s working!
We can refresh the screen and see the data that is already being created by the processes that are executing.
Just one final thing, to activate light BPT execution in OutSystems, it’s necessary to head over to the service center and enable the execution of lightweight BPT by ticking the checkbox and clicking apply.
Have fun building Light BPT.
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.