Connection and Consumption setup
Connecting to LSports RabbitMQ
So you've started to implement LSports services via RMQ, great choice! Let's get your connection running with a few simple steps.
This guide is intended to provide a better understanding of how the LSports Support team works to resolve issues in a timely manner and with minimal effort on your part.
Step-by-step instructions:
The following example refers to these credentials: Username: MyEmail Password: Passw0rd1234 PackageId: 102030 (You should use the credentials provided by LSports)
Note: All examples below are written in C#.
Should you choose to implement your own code, you will need to get the RMQ library Here.
Start off by making sure that your package is enabled by sending an API call as follows: *Please verify you use the credentials provided by LSports*
InPlay Package: https://inplay.lsports.eu/api/Package/EnablePackage?username=MyEmail&password=Passw0rd1234&packageid=102030
Prematch Package: https://prematch.lsports.eu/OddService/EnablePackage?username=MyEmail&password=Passw0rd1234&guid=guid-provided-by-LSports
Response:
Please know that you can also disable your package if you are in need of turning it off by changing the "EnablePackage" to "DisablePackage" as follows:
InPlay Package: https://inplay.lsports.eu/api/Package/DisablePackage?username=MyEmail&password=Passw0rd1234&packageid=102030
Prematch Package: https://prematch.lsports.eu/OddService/DisablePackage?username=MyEmail&password=Passw0rd1234&guid=guid-provided-by-LSports
If the package was already enabled/disabled then the message should contain "Value was already set". For any other status or error message, please recheck your credentials or contact us.
Create a connection factory as follow:
Create a connection as follows:
Create a model as follows:
Configure the quality of service:
Consume message:
Start message consumption:
(make sure to type in your package ID using underscores ('_') as described) For example, if the package ID was “102030”
From here you should be able to pull up your RMQ connection and start receiving Heartbeat messages.
Full Snapshot Request
Since updates coming through RMQ are deltas only, on your initial connection to RMQ, you should first request a one-time snapshot of the data you are expected to receive before you start consuming messages from LSports.
You can do so by making an API call to the following:
Inplay Snapshot - Provides data for all events that are currently in play.
Prematch Get events - Provides data for the requested event(s).
Possible error types
Note: If the queue reaches 10000 unconsumed messages, it will automatically delete the messages, disable the queue, and your package will be disabled.
To reenable your queue, you should use the enable package API request.
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 are typed correctly.
"Access refused"- Please check that your package is enabled and that the login credentials and package ID were typed correctly.
In case you are using more than 1 consumer:
The messages will be received in a round-robin fashion, the data will be distributed equally among all existing consumers. You'll need to manage the message sequence on your side.
For an in-depth explanation of our data structure, please continue reading our documentation.
Now all you need to do is, to start ordering our sports data according to your specific needs.
Message Deserializing
The data you receive via RabbitMQ arrives as an array of bytes. The array of bytes has to be deserialized in order for it to become readable. The deserialization method depends on the format that you have selected to get the data in. If the format you have selected is JSON/XML – Simply decode the message as follows:
Market/Bet Message Handling
To reduce message size and improve transfer speed, all messages are sent in delta format, meaning only changes will be delivered.
However, after placing an order and once data becomes available, your consumer will first receive initial messages containing complete information for all markets. From that point forward, only delta updates will be sent for market messages.
Each message will include a reference to the Fixture, Market, and Bet (see the Markets section) to which it belongs.
Example
The following is an initial message for 1X2 market:
The message is linked to Fixture Id 3115994 as seen in the example above.
The next message will be a delta message sent as follows. This message contains the Id of the Fixture as a reference, as did the previous message, but the only bet in it is the updated one. In this example, the price of the bet “1” bet was updated. -
Last updated
Was this helpful?