Asynchronous Microservices

When to use:

  • To handle long running jobs or tasks.
  • When client doesn’t want to wait for a response.
  • To provide better user experience
  • To achieve eventual consistency.
  • When immediate response is not required.
  • To send notifications to other systems or microservices.
  • To deal with publisher and subscriber scenario.


  • Event based communication

    In Event based communication, client sends the message with the help of message broker which can be received and processed by all the interested services.
When to use
      • When there is a single sender and multiple receivers
      • To decouple client and service(s).
      • To raise an integration event where side effects will be taken care by other services.
      • To process long running task.
      • When single event requires multiple tasks to be completed in backend.
      • To achieve eventual consistency.
Patterns to be considered
  • Asynchronous API call with Callback

    In Asynchronous API call option, the client application makes a call to API/Service and doesn’t wait for the response but registers a callback (endpoint address) to API/Service where API/Service sends the response later.
Request with callback
When to use
  • To process long running tasks in background.
  • When request processing logic is dependent on other task which cannot execute immediately.
  • When external service is responsible for executing of background task and external service not respond immediately
  • To process long running task.
Patterns to be considered
  • If required then ProcessLongTask() method shown in the above image might implement the event based communication with related patterns.
Please share this

Leave a Reply