Skip to content

Repository ini menampung hasil pengerjaan untuk menyelesaikan study case async API. Dibuat oleh kelompok 2 kelas 3B mata kuliah Pengembangan Web, JTK Polban.

Notifications You must be signed in to change notification settings

delvitord/async-api-stable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

async-api

Repository ini menampung hasil pengerjaan untuk menyelesaikan study case async API. Dibuat oleh kelompok 2 kelas 3B mata kuliah Pengembangan Web, JTK Polban.

Case Study Description :: Asynchronous API

Technology - Spring Boot Tracing Difficulty - None Implementation Difficulty - Medium Hard

The Condition

You are developing an application where there is long running process on some endpoints. The process could take up to minutes or even hours.

The Problem

Due to the long processing time, there is a possibility that a timeout or memory leak might occur within the application, or on the client side.

Process Request
    |
x minutes/hours   x-------x timeout
    |
Finished Response

The Objective

You need to implement a mechanism, where the process could run in parallel, and the client is not required to wait for the response, but could fetch it another time.

Process Request ----> Result Request ----> Result Request
    |                       |                    |
x seconds               x seconds            x seconds
    |                       |                    |
Accepted Response   Unfinished Response  Finished Response
                        (repeat)

You could also implements Signaling or PubSub mechanism to achieve this.

Process Request
    |
x seconds
    |
Accepted Response

--- --- ---

Finished Signal -------------> Result Request
                                     |
                                 x seconds
                                     |
                              Finished Response

The Expected Result

The long running API main call is now could responds within seconds, and the response could be fetched another time in the future.

Yang Telah Kelompok Kami Lakukan

  • Kami telah mengimplementasikan Async API pada study case kami dengan mekanisme Polling Model
  • Ketika /start, program akan generate dan segera menampilkan processId. Lalu ketika /poll/{processId}, jika program belum selesai generate randomUUID sejumlah yang dituliskan pada code, maka program akan mengeluarkan status "Sedang Diproses...".
  • Kami telah mendeploy hasil pekerjaan kami ke dalam Virtual Machine.

About

Repository ini menampung hasil pengerjaan untuk menyelesaikan study case async API. Dibuat oleh kelompok 2 kelas 3B mata kuliah Pengembangan Web, JTK Polban.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages