TsgcWSPClient_STOMP_RabbitMQMethods › NACK

NACK Method

Rejects a previously received message so the broker can requeue or dead-letter it.

Syntax

procedure NACK(const aId: string; const aTransaction: String = '');

Parameters

NameTypeDescription
aIdconst stringValue of the ack header carried by the incoming MESSAGE frame; identifies the message being rejected.
aTransactionconst StringOptional transaction identifier; when supplied, the rejection is included in the named transaction and only takes effect on commit.

Remarks

NACK is the negative counterpart of ACK and tells RabbitMQ the message was not consumed successfully. Depending on the queue configuration the broker will requeue the message for redelivery or route it to the configured dead-letter exchange. Only valid for subscriptions created with ackClient or ackClient-Individual.

Example

procedure TForm1.sgcRabbitMQMessage(Connection: TsgcWSConnection;
  MessageText: String; Headers: TsgcWSRabbitMQSTOMPHeadersMessage;
  Subscription: TsgcWSBrokerSTOMPSubscriptionItem);
begin
  if not ProcessMessage(MessageText) then
    sgcRabbitMQ.NACK(Headers.Ack);
end;

Back to Methods