TsgcWSPClient_STOMP_ActiveMQEvents › OnActiveMQMessage

OnActiveMQMessage Event

Fires when a MESSAGE frame is received for an active ActiveMQ subscription; delivers the body, the typed Headers and the originating Subscription item.

Syntax

property OnActiveMQMessage: TsgcWSActiveMQSTOMPMessageEvent;
// TsgcWSActiveMQSTOMPMessageEvent = procedure(Connection: TsgcWSConnection; MessageText: String; Headers: TsgcWSActiveMQSTOMPHeadersMessage; Subscription: TsgcWSBrokerSTOMPSubscriptionItem) of object

Default Value

Remarks

Raised every time the ActiveMQ broker dispatches a MESSAGE frame to one of the client's subscriptions. Parameters:

Example

procedure TForm1.ActiveMQMessage(Connection: TsgcWSConnection;
  MessageText: String; Headers: TsgcWSActiveMQSTOMPHeadersMessage;
  Subscription: TsgcWSBrokerSTOMPSubscriptionItem);
begin
  Memo1.Lines.Add(Format('[%s] %s', [Headers.Destination, MessageText]));

  // acknowledge when the subscription requires it
  if Headers.ACK <> '' then
    ActiveMQ.ACK(Headers.MessageId, Headers.Subscription);
end;

Back to Events