In order to connect to a AMQP Server, you must create first a TsgcWebSocketClient and a TsgcWSPClient_AMQP. Then you must attach AMQP Component to WebSocket Client.
Connect to AMQP server without authentication. Define the AMQPOptions property values, virtual host and then set in the TsgcWebSocketClient the Host and Port of the server.
If you are using a TCP Plain connection, set the TsgcWebSocketClient property Specifications.RFC6455 to false.
oAMQP = new TsgcWSPClient_AMQP();
oAMQP->AMQPOptions->Locale = 'en_US';
oAMQP->AMQPOptions->MaxChannels = 100;
oAMQP->AMQPOptions->MaxFrameSize = 16384;
oAMQP->AMQPOptions->VirtualHost = '/';
oAMQP->HeartBeat->Enabled = true;
oAMQP->HeartBeat->Interval = 60;
oClient = new TsgcWebSocketClient();
oAMQP->Client = oClient;
oClient->Specifications->RFC6455 = false;
oClient->Host = 'www.esegece.com';
oClient->Port = 5672;
oClient->Active = true;
If the server requires authentication, use the event OnAMQPAuthentication to select the Authentication mechanism (if required) and set the User / Password.
oAMQP = new TsgcWSPClient_AMQP();
oAMQP->AMQPOptions->Locale = 'en_US';
oAMQP->AMQPOptions->MaxChannels = 100;
oAMQP->AMQPOptions->MaxFrameSize = 16384;
oAMQP->AMQPOptions->VirtualHost = '/';
oAMQP->HeartBeat->Enabled = true;
oAMQP->HeartBeat->Interval = 60;
oClient = new TsgcWebSocketClient();
oAMQP->Client = oClient;
oClient->Specifications->RFC6455 = false;
oClient->Host = 'www.esegece.com';
oClient->Port = 5672;
oClient->Active = true;
private void OnAMQPAuthentication(TObject *Sender, TsgcAMQPAuthentications *aMechanisms, ref TsgcAMQPAuthentication *Mechanism,
ref string User, ref string Password)
{
User = "user_value";
Password := "password_value";
}