(* Collection of code snippets by Arne Vajhøj *)
(* (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) *)
program Recv;

uses
  StompClient, StompTypes, delphistomp, laz_synapse;

const
  HOST = 'localhost';
  PORT = 61613;
  UN = 'arne';
  PW = 'topsecret';
  QNAME = '/queue/TestQ';

var
  cli : IStompClient;
  fr : IStompFrame;
  s : string;

begin
  cli := TStompClient.Create.SetUserName(UN).SetPassword(PW);
  cli.Connect(HOST, PORT);
  cli.Subscribe(QNAME);
  while true do begin
    fr := cli.Receive(3600000);
    s := fr.GetBody;
    writeln(s);
  end;
  cli.Unsubscribe(QNAME);
  cli.Disconnect;
end.
