Connection and Consumption setup
Connecting to VelocityFeed - RabbitMQ
This guide is intended to provide a better understanding of how the VelocityFeed messages works.
The following example refers to these credentials:
Username: MyEmail
Password: Passw0rd1234
Package: 102030
Queue: myQueue
(You should use the credentials provided by VelocityFeed)
Note: All examples below are written in C#.
When implementing your code, you need to get the RMQ library here.
Please be aware that VelocityFeed currently uses version 3.12.10
- Create a connection factory as follows:
ConnectionFactory connectionFactory = new ConnectionFactory
{
HostName = "Described below",
Port = 5672,
UserName = "MyEmail",
Password = "Passw0rd1234",
AutomaticRecoveryEnabled = true,
VirtualHost = "StmPreMatch",
RequestedHeartbeat = 580,
NetworkRecoveryInterval = TimeSpan.FromSeconds(1)
};
- Create a connection as follows:
IConnection connection = _connectionFactory.CreateConnection();
- Create a model as follows:
IModel model = connection.CreateModel();
- Configure the quality of service:
model.BasicQos(prefetchSize: 0, prefetchCount: 100, global: false);
- Consume message:
EventingBasicConsumer consumer = new EventingBasicConsumer(model);
consumer.Received += (sender, eventArgs) =>
{
// Deserialize message
// Call method to handle deserialized message
};
- Start message consumption:
(make sure to type in your package ID using underscores ('_') as describes) For example, if package ID was “102030”
model.BasicConsume(queue: 'myQueue', noAck: true, consumer: consumer)
- From here you should be able to pull up your RMQ connection and start receiving Heartbeat messages.
- The maximum consumers allowed is 60; once the limit is exceeded, the package will be automatically disabled.
Note: Before connecting more than 1 consumer, customers must implement a message sorting mechanism to avoid data discrepancies.
Full Snapshot Request
Staying Up-to-Date with TRADE Data
When you subscribe to a fixture (event) on TRADE, the first message you receive will be a complete picture, including all data for the fixture and its markets. This is followed by updates (deltas) that only reflect changes to the data.
Reconnecting and Getting Back on Track
If you ever disconnect from the TRADE feed, it's important to request a snapshot of the data before you start consuming the feed again. This ensures you have the latest information. You can request a snapshot using an API call. LSports offers two types of snapshots:
- InPlay Snapshot - Provides data for all events that are currently inplay.
- PreMatch Snapshot - Provides data for all events that are currently prematch.
By comparing the timestamps of the snapshot data with the timestamps of the updates you receive in the feed, you can identify any missing information and keep your data synchronized.
Possible error types
Note: If the queue reaches 10000 unread/unpacked messages it will be automatically purged and your distributor connection will be disabled.
Most failed connection attempts occur due to incorrect credentials or incorrect connection details.
Here are the most common errors and possible solutions:
"Connection failed" - Please check that the connection details i.e. Connection factory, RMQ host, VirtualHost were typed correctly.
"Access refused"- Please check that your package is enabled and the login credentials and package ID were typed correctly.
For an in-depth explanation of our data structure, you may continue reading our documentation.
Now all you need to do is, to start ordering our sports data according to your specific needs.
An email notification will be sent to your contacts upon deletion of your queue