I am using Qpid Proron 0.18.1 version. The idle_timeout is printing out to be,
connection.idle_timeout() : 15000
. I am not able to trace back to the code where the default value 15000
is set. Also, when I am changing it in container as follows:
c.connect(conn_url, co.idle_timeout(proton::duration::FOREVER));
This is making the broker time out after a minute. However,
c.connect(conn_url, co.idle_timeout(proton::duration::SECOND));
is not making the broker timeout at all even though I thought that this should timeout after a second of the broker being idle.
It would be great if someone can explain me about idle_timeout()
and if there is a possibility to change its default value.
Thanks!
First, some general information about AMQP idle-timout:
I think you may have a misunderstanding about what idle_timeout is supposed to do (the name can be a little misleading).
This setting is meant to detect that the peer you are connected to has stopped responding even though it is still connected at the socket level. The timeout value used should be set by how long you want to wait to detect that your peer is no longer responding to you.
What it does is request that the peer you are connected to sends at least 1 AMQP frame within the idle_timeout period. If there is no frame being sent because of message transfer etc. then it should send an empty frame. Typically the peer will send these keep-alive or heartbeat frames at half the idle-timeout period just to make sure that network conditions don't result in spurious timeouts.
Its also important to know that each half of the communication has its own idle-timeout value. That is, the communication from client to broker will have a different idle-timeout value from the communication in the other direction.
Now to look at your specific questions:
I am using Qpid Proron 0.18.1 version. The idle_timeout is printing out to be, connection.idle_timeout() : 15000. I am not able to trace back to the code where the default value 15000 is set.
What you are seeing here is the idle_timeout value set by the other side of the connection. It is telling the proton implementation to send at least 1 frame every 15s or it will consider the connection timed out. This happens without you having to do anything in the C++ implementation you are using.
c.connect(conn_url, co.idle_timeout(proton::duration::FOREVER));
This is making the broker time out after a minute.
What the code here is doing is effectively telling the broker to never send any keep-alive frames - it is actually the same as not setting the property at all, as the default is not to send the frames.
I'm pretty sure that this is not making the broker timeout - as I explained above it is setting the idle-timeout in the wrong direction for this. I'd guess that it has an entirely separate configuration that is timing you out because you didn't do anything in a minute and it wants to conserve resources - I seem to remember that Azure Servicebus will do this.
c.connect(conn_url, co.idle_timeout(proton::duration::SECOND));
is not making the broker timeout at all even though I thought that this should timeout after a second of the broker being idle.
This is telling the broker to send at least one frame every second, it is not telling the broker to disconnect if nothing happens in a second. If you are using the same broker as before, I'm not sure why it's not timing out after the same minute, but in any case this will only timeout if something bad happens to the broker.