TsgcWSPClient_AMQPEvents › OnAMQPBasicGetOk

OnAMQPBasicGetOk Event

Fires when a synchronous basic.get call returns a message (basic.get-ok).

Syntax

property OnAMQPBasicGetOk: TsgcAMQPBasicGetOkEvent;
// TsgcAMQPBasicGetOkEvent = procedure(Sender: TObject; const aChannel: string; const aGetOk: TsgcAMQPFramePayload_Method_BasicGetOk; const aContent: TsgcAMQPMessageContent) of object

Default Value

Remarks

Raised in response to a GetMessage pull request when a message was available. aGetOk exposes the delivery tag, redelivered flag, exchange, routing key and the number of messages still sitting in the queue (MessageCount). aContent holds the message properties and payload. If instead the queue is empty the client raises OnAMQPBasicGetEmpty.

Example

procedure TForm1.oAMQPAMQPBasicGetOk(Sender: TObject; const aChannel: string;
  const aGetOk: TsgcAMQPFramePayload_Method_BasicGetOk;
  const aContent: TsgcAMQPMessageContent);
begin
  DoLog(Format('#AMQP GetOk [%s] remaining=%d: %s',
    [aChannel, aGetOk.MessageCount, aContent.Body.AsString]));
  oAMQP.BasicAck(aChannel, aGetOk.DeliveryTag);
end;

Back to Events