TsgcWSPClient_AMQP1Events › OnAMQPMessage

OnAMQPMessage Event

Fires when a complete message arrives on a receiver link; the handler chooses the terminal delivery state that is sent back to the peer.

Syntax

property OnAMQPMessage: TsgcAMQP1MessagenEvent;
// TsgcAMQP1MessagenEvent = procedure(Sender: TObject; const aSession: TsgcAMQP1Session; const aLink: TsgcAMQP1ReceiverLink; const aMessage: TsgcAMQP1Message; var DeliveryState: TsgcAMQP1MessageDeliveryState) of object

Default Value

Remarks

Raised when the last Transfer frame of a message has been reassembled on a receiver link. aMessage exposes the standard AMQP 1.0 message sections: Header, Delivery-Annotations, Message-Annotations, Properties, Application-Properties, Body (value / data / sequence) and Footer. Use the DeliveryState var parameter to decide the outcome the component sends in the Disposition frame: Accepted, Rejected (with an optional error), Released or Modified. The handler runs on the reader thread — marshal UI updates and keep the work small. Ignoring the parameter leaves the delivery unsettled if the receiver settle-mode allows it.

Example

procedure TForm1.oAMQP1AMQPMessage(Sender: TObject;
  const aSession: TsgcAMQP1Session; const aLink: TsgcAMQP1ReceiverLink;
  const aMessage: TsgcAMQP1Message;
  var DeliveryState: TsgcAMQP1MessageDeliveryState);
begin
  DoLog('#AMQP1 message: ' + aMessage.Text);
  DeliveryState := amqpDeliveryStateAccepted;
end;

Back to Events