Search code examples
wso2wso2-esbwso2-enterprise-integrator

How to call a Service/ API Asynchronously


I am trying to invoke a service/ API asynchronously and I noticed the thread get blocked when I invoke the service which behaves like a synchronous.

How can I call a service/ API asynchronously?


Solution

  • Assuming you are referring to API Manager, all the API invocations are, by default, asynchronous. Once the Gateway receives a request, it passes it to the backend and releases the thread for accepting other requests.

    If you are referring to ESB/ Integrator, then you can use the Call mediator to invoke services/ APIs either asynchronously or synchronously. The Call mediator has a properly called, Blocking which can be used to control the mode - asynchronously or synchronously. Blocking set to true means it behaves in synchronous mode.

    For more information - https://apim.docs.wso2.com/en/4.0.0/reference/mediators/call-mediator/