Connecting to an AMQP queue
ts
function Connect(): boolean;Before calling the Connect() method on any AmqpClient091 or AmqpClient10 object, you must first set the required object properties.
The Connect() method returns true if the connection to the AMQP message queue is successful, or false if it fails.
Example
ts
ConsoleFeedback = true;
var cli = new AmqpClient091();
cli.URL = 'amqp://localhost:5672';
cli.User = 'guest';
cli.Pass = 'guest';
if (cli.Connect()) {
cli.MonitorQueue('myqueue');
while (true) {
Sleep(1000);
if (HaltSignalReceived()) {
break;
}
var msgs = cli.GetMessages();
if (msgs.length > 0) {
Log(JSON.stringify(msgs));
}
}
cli.Close();
}
cli = null;