Connecting to an AMQP queue
ts
function Connect(): boolean;
Before calling the Connect()
method of any AmqpClinentXX object of your choice it is necessary to populate the object properties.
The Connect()
method returns true if the connection to the AMQP message queue is successful, otherwise it returns false.
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;
}