Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor AMQP link detach/close handling to clarify link lifecycle #1700

Open
kgiusti opened this issue Dec 17, 2024 · 0 comments
Open

Refactor AMQP link detach/close handling to clarify link lifecycle #1700

kgiusti opened this issue Dec 17, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@kgiusti
Copy link
Contributor

kgiusti commented Dec 17, 2024

The code that handles the creation and deletion of AMQP links is implemented to support a deprecated feature called AMQP link attach routing. Since this feature has long been removed from the router it would be a good idea to see if we can simplify the AMQP link lifecycle.

Currently there is a lot of logic involved in tracking the attach/detach performative handshakes that can be simplified now that link attach routing is no longer supported.

Specifically the point where the link lifecycle terminates is a little ambiguous especially where the qd_link_t/qdr_link_t state is shared between the core and I/O threads.

@kgiusti kgiusti added the enhancement New feature or request label Dec 17, 2024
@kgiusti kgiusti self-assigned this Dec 17, 2024
kgiusti added a commit to kgiusti/skupper-router that referenced this issue Dec 17, 2024
This change removes some of the old link attach routing logic and
attempts to clean up the link API.

The logic that used to track the exchange of Attach/Detach
performatives has been simplified. The various counters and booleans
maintained by the qdr_link_t structure for tracking this exchange has
been reduced to a mask/flag implementation similar to Protons
implementation of endpoint state.

This patch refactors the link detach adaptor API to be more like the
existing AMQP connection API: there is now an explict API call to
release the link instance at the end of its lifecycle.

The adaptor API is modified by separating the AMQP detach handling
from the release of the link instance. The old qdr_link_detach()
adaptor function has been refactored into two functions:
qdr_link_detach_received() and qdr_link_close().

The qdr_link_detach_received() call is made by the AMQP adaptor when a
Detach Peformative has been received by the peer. It is only used by
the AMQP adaptor.

The new qdr_link_closed() API call is made by all adaptors when the
link instance is destroyed. This is similar to the existing
qdr_connection_closed() call but for links. It is used by all adaptors
to indicate to the core that the link is no longer in use and can be
cleaned up. In the case of the AMQP adaptor this call will be made
after the link detach handshake has completed.

Test coverage by the test-sender AMQP client has been increased by
adding a clean connection close function.
kgiusti added a commit to kgiusti/skupper-router that referenced this issue Dec 17, 2024
This change removes some of the old link attach routing logic and
attempts to clean up the link API.

The logic that used to track the exchange of Attach/Detach
performatives has been simplified. The various counters and booleans
maintained by the qdr_link_t structure for tracking this exchange has
been reduced to a mask/flag implementation similar to Protons
implementation of endpoint state.

This patch refactors the link detach adaptor API to be more like the
existing AMQP connection API: there is now an explict API call to
release the link instance at the end of its lifecycle.

The adaptor API is modified by separating the AMQP detach handling
from the release of the link instance. The old qdr_link_detach()
adaptor function has been refactored into two functions:
qdr_link_detach_received() and qdr_link_close().

The qdr_link_detach_received() call is made by the AMQP adaptor when a
Detach Peformative has been received by the peer. It is only used by
the AMQP adaptor.

The new qdr_link_closed() API call is made by all adaptors when the
link instance is destroyed. This is similar to the existing
qdr_connection_closed() call but for links. It is used by all adaptors
to indicate to the core that the link is no longer in use and can be
cleaned up. In the case of the AMQP adaptor this call will be made
after the link detach handshake has completed.

Test coverage by the test-sender AMQP client has been increased by
adding a clean connection close function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant