'Mule 3 : http listener persistent connections and Connection Idle timeout

I am new to Mule and trying to learn Mule 3 (some of our existing API in production are using Mule 3).

A production application has an HTTPlistener using 'use Persistent connection' and 'connection idle timeout' as default value of 30000 (30 seconds).

My understanding i that if I call the API that listens to the request at this listener from Postman (the REST client), if the request takes more than 30 seconds, it should receive a timeOut error (504).

We added a Thread.sleep in an expression to simulate this behavior.

<expression-component doc:name="Expression"><![CDATA[Thread.sleep(60000);]]></expression-component>

This will cause the sleep to wait for 1 minute, which is greater than 30 seconds configured for a timeout.

However, the request waits for the thread to wake up after 1 minute and returns a successful response.

So I am not sure what is the purpose of 'connection idle timeout' ? Also, what does 'persistent connection' mean ?

The documentation is vague.



Solution 1:[1]

HTTP Persistent Connections are a feature of the HTTP protocol, that the connector implements. The connection idle time indicates how long the persistent connection will remain open if there is no activity. It is not related to a response timeout, that is a timeout on the client side and seems to be what you are expecting. In this case the HTTP Listener is the server and Postman is the client.

A response timeout in the client doesn't has an HTTP status response because the request is aborted. You can get a 504 status if the request is against a proxy and the proxy has a client timeout against a backend. The proxy usually returns a 504 in that scenario.

The documentation for connectors assumes that you are familiar with the protocol or backend concepts. In this case the HTTP protocol.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 aled