TsgcWSPClient_AMQPMethods › CloseEx

CloseEx Method

Closes the AMQP connection synchronously and returns True when the broker acknowledged the close.

Syntax

function CloseEx(aReplyCode: Word; const aReplyText: string; aFailClassId: TsgcAMQPClass = amqpClassNone; aFailMethodId: TsgcAMQPMethod = amqpMethodNone): Boolean;

Parameters

NameTypeDescription
aReplyCodeWordAMQP reply-code returned to the broker (use 200 for a clean close).
aReplyTextconst stringHuman-readable reply-text returned to the broker.
aFailClassIdTsgcAMQPClassAMQP class-id of the offending method when closing after an error (amqpClassNone for a normal close).
aFailMethodIdTsgcAMQPMethodAMQP method-id of the offending method when closing after an error (amqpMethodNone for a normal close).

Return Value

True when the broker acknowledged the close, False on timeout or error. (Boolean)

Remarks

Extended variant of Close that waits for connection.close-ok before returning. Use when the calling code needs to be certain the close handshake completed before tearing down resources.

Example

if sgcWSPClient_AMQP1.CloseEx(200, 'OK') then
  // connection cleanly closed

Back to Methods