TsgcWSPClient_AMQP1 › Methods › CloseLink
Detaches an AMQP 1.0 link (sender or receiver) from its session by sending the Detach frame.
function CloseLink(const aSession, aName: string; const aOptions: TsgcAMQP1MethodOptions_CloseLink = nil): Boolean;
| Name | Type | Description |
|---|---|---|
aSession | const string | Name of the session the link is attached to. |
aName | const string | Link name used when it was attached via CreateSenderLink or CreateReceiverLink. |
aOptions | const TsgcAMQP1MethodOptions_CloseLink | Optional 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. |
True when the Detach frame was written, False when the session or link is unknown. (Boolean)
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.
oAMQP1.CloseLink('session_1', 'sender_1');