Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to work with asynchronous process from external client?

please give me some advice about the best pattern of the task solution. My task is this:

  1. User makes a request to the Camunda processor through own rest controller
  2. BPMN schema on a backend side consists of a chain of several asynchronous services
  3. Data will be ready for response to the User only when one final service on BPMN makes it.

Every chain works not greater than 10-15 secs. And users sessions count is less than 500 an hour.

How to organize the work of the rest controller? Is it acceptable to force controller waiting of result in the same call? Where a bottleneck?

like image 272
Alexander Fedyukov Avatar asked Feb 15 '26 17:02

Alexander Fedyukov


1 Answers

Can you use some server push technology? If it were just a couple of seconds, I'd say go for waiting in the rest controller.

Being 15 seconds and thinking about scalability, I'd say to follow some kind of asynchronous pattern with the client to.

  1. Client sends a request to do something
  2. The controller delegates the work to some external process and returns to the client ok
  3. The process ends and a response is ready.
  4. If the other side is a browser, use some kind of server push technology to notify it. If it is an application use some kind of rpc, polling or any other inter process mechanism to communicate.

Note that depending on the hosting technology, there are different limits on concurrent connections. Check Spring Boot - Limit on number of connections created for tomcat.

like image 78
Athanasios Kataras Avatar answered Feb 18 '26 06:02

Athanasios Kataras



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!