[JAVA] How to implement asynchronous processing in Outsystems

Introduction

By participating in the Advent calendar as an IT member of the company that changed jobs, I will post an article on Qiita for the first time! Since I changed jobs, I have been developing apps at Outsystems. I would like to share what I couldn't find the answer in the process of development.

This time, I will introduce how to implement asynchronous processing in Outsystems.

Self-introduction

I will post for the first time, so I will introduce myself. Previously, I worked for about 7 years as an SE who is resident in various projects with about 30 SIers. At that time, I was developing in Java and C #, and also doing upstream processes such as requirement definition and design. From there, I changed jobs to a foreign-affiliated human resources company and became an in-house SE. Currently, Outsystems mainly develops apps for improving internal business efficiency.

table of contents

--What is asynchronous processing? --Implementation method in client processing --Implementation method in server processing

What is asynchronous processing?

What is asynchronous processing in the first place? I will explain it for those who say. I thought, but there was an article that explained it, so please refer to this. https://qiita.com/kiyodori/items/da434d169755cbb20447

For example, if you press a button on a web page and it takes a long time to go around the screen Usability is not good, so Processing that does not have to wait for the processing result will run asynchronously!

In Java, new a class that inherits Thread or a class that implements Runnable It seems to be realized by calling the start method, I couldn't find out how to achieve it with Outsystems, so I wanted to share it.

Let's go to the main subject!

Implementation method in client processing

For client processing, you can use Javascript setTimeout. For example, like this. image.png

What the image above is doing is Check the battery status of your smartphone or tablet and send an alert email when the battery is low I am creating a client action called NotifyBatteryStatus I'm calling it with setTimeout.

setTimeout($actions.NotifyBatteryStatus($parameters.Level, $parameters.IsPlugged), 0); The first argument of setTimeout is the action (with argument) that you want to process asynchronously. The second argument is how many milliseconds to execute. This time I want to execute it immediately, so I set it to 0.

Since sending an email has no choice but to call a server action, it takes time to process it via the network. I didn't have to look at the processing result, so I am trying to execute it asynchronously including the part that determines whether to send an email.

So if you want to make it asynchronous in client processing, you can use setTimeout! This seems to come out soon if you have experience with Javascript.

Implementation method in server processing

By the way, it is easy to reach that client processing can be done using Javascript. The implementation method in server processing is unique to Outsystems, and it took a long time to investigate. So, in conclusion, there are two ways!

Asynchronous processing using Timer (argument cannot be specified)

Timer is a batch process that starts schedule or executes manually, right? I'm feeling. You can call that Timer from a server action. image.png

Like this You can call the Timer process by dragging and dropping Wake ~ under the Timer into the server action. So, it works asynchronously with the server action you are performing. When you call Wake ~, it will not be executed immediately, but will be executed after a few seconds.

However, the difficulty with asynchronous processing in Timer is that parameters cannot be passed. The next solution is to solve it.

Asynchronous processing using Process (argument can be specified)

Have you ever used Process? I wasn't .. I felt like I could use it like this. image.png

You can call Launch ~ of Process from the server action and specify the argument. Entity is impossible, but BasicType such as Text and Integer and EntityIdentifier can be used as arguments. So pass the EntityIdentifier as an argument and It is possible to get data from Entity and process it in Process.

Finally

That's why I introduced how to implement asynchronous processing in Outsystems. Recently, Saas publishes various APIs, but it takes time to call them with REST or SOAP, so it takes time. I think it's common to call such processes asynchronously, so I hope you can refer to it!

Recommended Posts

How to implement asynchronous processing in Outsystems
How to implement date calculation in Java
How to implement Kalman filter in Java
How to implement coding conventions in Java
How to implement ranking functionality in Rails
How to disable user operations during asynchronous processing
How to implement a like feature in Rails
How to implement Pagination in GraphQL (for ruby)
How to make an image partially transparent in Processing
How to implement UICollectionView in Swift with code only
How to implement login request processing (Rails / for beginners)
How to implement guest login in 5 minutes in rails portfolio
How to implement a like feature in Ajax in Rails
[Rails, JS] How to implement asynchronous display of comments
Summary of how to implement default arguments in Java
[Rails] How to implement scraping
[Java] How to implement multithreading
[Rails] How to define macros in Rspec and standardize processing
How to implement infinite scrolling (page nate) in Swift TableView
How to implement one-line display of TextView in Android development
How to use Lombok in Spring
How to find May'n in XPath
How to hide scrollbars in WebView
Try implementing asynchronous processing in Azure
How to iterate infinitely in Ruby
Try to implement Yubaba in Ruby
How to run Ant in Gradle
How to master programming in 3 months
How to learn JAVA in 7 days
How to install Bootstrap in Ruby
Implementation of asynchronous processing in Tomcat
How to use InjectorHolder in OpenAM
How to introduce jQuery in Rails 6
[Rails] How to implement star rating
How to use classes in Java?
How to name variables in Java
How to set Lombok in Eclipse
Try to implement Yubaba in Java
[Processing × Java] How to use arrays
How to concatenate strings in java
How to install Swiper in Rails
I tried to implement Ajax processing of like function in Rails
How to implement a job that uses Java API in JobScheduler
[Behavior confirmed in December 2020] How to implement the alert display function
[RubyOnRails] How to implement pull-down in form_with based on table data
How to implement UI automated test using image comparison in Selenium
How to prevent duplicate processing by addEventListener
[swift5] How to specify color in hexadecimal
Multilingual Locale in Java How to use Locale
How to change app name in rails
How to use custom helpers in rails
How to reflect seeds.rb in production environment
How to use named volume in docker-compose.yml
Try to implement n-ary addition in Java
How to filter JUnit Test in Gradle
How to insert a video in Rails
How to include Spring Tool in Eclipse 4.6.3?
How to add jar file in ScalaIDE
How to do base conversion in Java
[Swift] How to fix Label in UIPickerView
[Processing × Java] How to use the loop