qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: c++ (and other bindings) auto close behavior for handlers?
Date Fri, 08 Apr 2016 09:21:26 GMT
On 07/04/16 21:07, Alan Conway wrote:
> Currently proton-C and the various bindings do *not* auto-close
> contained objects when the container closes. I.e. closing a connection
> does not close its sessions, closing a session does not close its links
> etc. Also closing a transport does not automatically close its
> connection.
>
> I believe there are some reconnect use-cases that require this, e.g. if
> the transport closes unexpectedly you want to keep the connection and
> its children around so you can use them to re-build connection state on
> a new transport.
>
> However in the majority of cases it is a huge pain. Look at the
> existing broker.cpp example, `remove_stale_consumers`. The example
> isn't even complete: you must implement transport_close,
> connection_close, link_close (or in C++ sender_close and
> receiver_close) AND session_close (forgotten in the broker.cpp example)
> to clean up link resources correctly.

The way I think of this, it is not that contained objects are not 
'auto-closed' so much as that there is no event that can be used to hook 
in application specific cleanup that is required whether or not the 
object was closed explicitly or implicitly (as a result of the object in 
which it is contained being closed).

> I'd like to find a way to automate this that doesn't break the
> reconnect cases. Ideally I'd like it to be the default behavior unless
> a reconnect handler is in play. Can that be done with the existing
> event set or do we need new events?

I think it would be prudent to retain the ability to distinguish between 
implicit and explicit 'close' if needed. It is also vital to distinguish 
between (at a minimum) detach and close for links, since these have 
different behaviour for many cases. (Ending a session detaches a link 
rather than closing it).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message