The Call mediator is used to send messages out of the ESB to an endpoint. The Call mediator invokes the service in a synchronous manner, and the underlying worker thread returns without waiting for the response. Mediation will be paused from that point. When the response is received, the mediation flow resumes from the next mediator in the sequence.
The Call mediator is similar to the Callout mediator, which performs a blocking external service invocation during mediation. Unlike the Callout mediator, the Call mediator leverages the non-blocking transports for much greater performance. Therefore, in most cases you should use the Call mediator instead of the Callout mediator. However, the Callout mediator is recommended in situations where you need to execute the mediation flow in a single thread.
...
Table of Contents | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
In the above configuration, the Call mediator is used to call invoke a backend service. An Enrich mediator is used to store the response received from the backend. for that service invocation.
The Filter Mediator added after the Call mediator carries out a filter to determine whether the first call has been successful. If it was is successful, second backend service is calledinvoked. The payload of the request to the second backend is the response to the first request (which is response of the first service invocation.
After a successful second backend service invocation, response of the first service is retrieved by the Enrich mediator from mediator from the property where it was formerly stored ). In this example, the second call is made to an HTTP endpoint, but you ca modify the configuration to send it to a JMS queue if required.If the second call is successful, the output of the first call is sent with HTTP 200. and sent to the client as the response using the respond mediator.
If it is not successful, a custom JSON error message is sent with HTTP 500. If the first call itself is not successful, the output is just sent back with the relevant error code.
...