TsgcWSPClient_AMQPEvents › OnAMQPTransactionOk

OnAMQPTransactionOk Event

Fires when the server acknowledges a transaction method: tx.select-ok, tx.commit-ok or tx.rollback-ok.

Syntax

property OnAMQPTransactionOk: TsgcAMQPTransactionOkEvent;
// TsgcAMQPTransactionOkEvent = procedure(Sender: TObject; const aChannel: string; aTransaction: TsgcAMQPTransaction) of object

Default Value

Remarks

A single event delivers the three possible transaction replies; aTransaction tells you which one: amqpTxSelect (the channel is now transactional), amqpTxCommit (all publishes and acks since the last commit/rollback have been persisted) or amqpTxRollback (all publishes and acks have been discarded). Use this event to resume your publishing loop after a successful commit or to handle a rolled-back batch.

Example

procedure TForm1.oAMQPAMQPTransactionOk(Sender: TObject;
  const aChannel: string; aTransaction: TsgcAMQPTransaction);
begin
  case aTransaction of
    amqpTxSelect:   DoLog('#AMQP Tx selected on ' + aChannel);
    amqpTxCommit:   DoLog('#AMQP Tx committed on ' + aChannel);
    amqpTxRollback: DoLog('#AMQP Tx rolled back on ' + aChannel);
  end;
end;

Back to Events