TsgcWSPClient_AMQP1Methods › CloseLink

CloseLink Method

Detaches an AMQP 1.0 link (sender or receiver) from its session by sending the Detach frame.

Syntax

function CloseLink(const aSession, aName: string; const aOptions: TsgcAMQP1MethodOptions_CloseLink = nil): Boolean;

Parameters

NameTypeDescription
aSessionconst stringName of the session the link is attached to.
aNameconst stringLink name used when it was attached via CreateSenderLink or CreateReceiverLink.
aOptionsconst TsgcAMQP1MethodOptions_CloseLinkOptional options record. Set Closed=True for a clean detach that frees the link name on the peer; attach an Error to report a condition. Pass nil for the default clean detach.

Return Value

True when the Detach frame was written, False when the session or link is unknown. (Boolean)

Remarks

Writes a detach performative with closed=true (by default) so the link handle is fully released on both peers. The broker mirrors the Detach which surfaces as OnAMQPLinkClose. Links can be detached temporarily (without closed) to drain credit and reattached later; to force-remove state use this method with the default options. Pending unsettled deliveries on the link are lost unless they were settled first.

Example

oAMQP1.CloseLink('session_1', 'sender_1');

Back to Methods