For receiving events, the Reporting API requires a connection to RabbitMQ, a well-known message broker suite.
Connections to our RabbitMQ node are only possible from whitelisted IPs. To whitelist your IPs, please provide them to Spotware’s service assurance team.
To connect to RabbitMQ, all you have to do is perform these actions.
All C# examples below use the
RabbitMQ.Client
Nuget package, which you can install using any suitable Nuget package management service.
All Java examples below use the RabbitMQ Java client that you can install using any suitable dependency management system or build tool such as Maven or Gradle.
Stunnel is an application that you can use to provide TSL/SSL encryption functionality to a connection.
To connect to the RabbitMQ node, Stunnel should be successfully deployed and accessible from your client. Stunnel should also be configured properly; this configuration is provided by Spotware’s service assurance team.
After routing your connection via Stunnel and whitelisting your IPs, you will have to connect to the correct host via your application or service. This can be done as follows.
The values of
hostName
,password
,portNumber
, anduserName
are provided by Spotware’s service assurance team upon request.
Connections are meant to handle many operations and, therefore, should stay open for long periods of time. It would be inefficient to establish a new connection for every new action you need to perform.
var factory = new ConnectionFactory {
HostName = hostName,
Password = password,
Port = portNumber,
UserName = userName,
};
IConnection conn = factory.CreateConnection();
var channel = conn.CreateModel();
ConnectionFactory factory = new ConnectionFactory();
factory.setUsername(userName);
factory.setPassword(password);
factory.setVirtualHost(virtualHost);
factory.setHost(hostName);
factory.setPort(portNumber);
Connection conn = factory.newConnection();
var channel = conn.createChannel();
Note that it is possible to establish multiple connections to our RabbitMQ node. If you choose to do so, all events sent via RabbitMQ will be split according to the round-robin principle.
At this point, you should be ready to receive events; this functionality is covered in a separate tutorial.