Betradar - the betting arm of Sportradar
Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt Include | ||||||
---|---|---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
Excerpt Include | ||||||
---|---|---|---|---|---|---|
|
Panel | |||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
This section includes instructions and details relevant to performing a recovery in Unified feed using the API. Please make sure to read the provided description and information regarding the different endpoints and if available, notes on performing recovery in edge cases. Table of contents:
Max recovery periods for producers
Recovery endpoints
All of these endpoints return either success or failure. If success, the actual messages come as one or more message per match over AMQP. The recovery sequence ends with a snapshot_complete message being sent:
The (product) argument in the API (table above) can be one of the following: liveodds, pre, betpal, mts or virtuals
All requests can have an additional parameter request_id=X, Where X is an integer of your own choice. The contract is that if this request ID if present, it will be included in all stateful messages resulting from this call as an extra attribute, and it will be included in the snapshot_complete message once all messages have been sent. You set a request_id if you want to track the results of individual requests. All requests can also have an additional (optional) parameter node_id=Y, where Y is an integer of your choice. If you have multiple sessions, Betradar’s suggestion is that you use different numbers for different sessions. During the recovery the node_id you passed in will be sent in as the 8th word in the routing key. This way you can add a binding key that ensures that you only receive recovery messages for your particular session, and not for your other sessions.
The after parameter is specified in milliseconds since Epoch UTC. This is for example: https://currentmillis.com/ The after parameter should normally be set to the timestamp of the last message received. This should be the timestamp in the message itself, not something the client system computed when it read the message. If the timestamp is not too far in the past, the client system is guaranteed to have current odds for any active matches, and also all bet_settlement, bet_cancel and rollbacks that have happened inbetween the timestamp and now.
The client system may receive messages sent before the timestamp provided. The client system should be built robust enough to handle this. The closer the after timestamp is to now, the better it is. If If the last message you received was more than the the max recovery period for the producer, this is too far in the past. If the client system does not specify the after parameter, this means: “I am new, just send me current active odds”. The response to this is that all current odds for live matches (where odds are active) are sent. The Live Odds producer handles all the live matches, but the prematch producers sends all matches where we have generated odds, and the match_status description=”not_started”. If the after parameter is too far in the past or in the future, it will result in the request getting rejected and if the client system was not subscribed previously, the client system will remain unsubscribed. Recovery and bet_settlement messagesPlease be aware that multiple bet_settlements can be merged into one single bet_settlement message during recovery as well. For example: “If a bet_settlement was sent out at half-time for half-time markets, and another bet_settlement was sent after the match, the recovery bet_settlement for the same match will than include both the half-time and post-match markets in one message”. Recovering all bet settlements for a specific eventUnder some circumstances you may have missed/lost some bet_settlements in a match. Or you may want to recover the state of a match the results for a match that ended more than three days ago. In such cases, you can call a specific end-point to recover all bet_settlements, bet_cancels and rollbacks done for a particular event. Recovery sequenceProper recovery requires the following steps:
Recovery sequence when an <alive product="x" subscribed="0"/> is receivedWhenever an alive message is received and the subscribed attribute in the message is set to 0, This means that a particular odds producer has been down (due to maintenance or some system error), and your system needs to initiate a partial recovery. This is done following the same steps as above, but in step two, only an API-call for the product that reported it was down is called. I.e. you receive:
you call pre/recovery/initiate_request and process messages as outlined above until snapshot_complete is received. Handling special states
Forced betstopIn case of the following scenario:
In this case, the client system should automatically betstop all markets for the match. This is an extra precaution if the prematch system is down and you have not yet noticed this happening. Handed_over market state during recoveryDuring recovery a producer may send a message saying that some markets have been handed_over. This is not a market state, but an indicator that since the disconnect happened this producer has handed over odds production for this market to another odds producer. If you already have received odds for this market from another odds producer, you can ignore this message, otherwise you should now mark this market as suspended. You should shortly receive odds from the other producer after it is handed over. For more information about the life cycle of market, see this chapter. Settled and cancelled market state during recoveryDuring recovery some markets can be sent with the market state settled. This means that bet_settlements already have been sent for this market. This can for example happen during the 2nd half in soccer, where the 1st half markets have already been settled. There is no more activity expected for this market (the only way the system can change this is to send a rollback_betsettlement. Similarly, during recovery a market can be sent with the market state cancelled, which should be treated in the same manner as above - no more activity is expected, and if you haven’t already received a bet_cancel when recovery ends, a bet_cancel message has been missed somewhere. General recommendations for market state handling when an Odds Producer is unavailableIf a match is live and the client system loses connection to the odds producer providing odds for that market, the client system must set all markets to suspended and stop accepting tickets. If a match is not yet live, you have a choice: Either suspend all markets directly and stop accepting tickets. Alternatively, sport-events that are more than e.g. 2 hours from scheduled start time can be kept open as it is unlikely that there will be significant odds changes, and you are likely to get connected again shortly. However, we still recommend that if you haven’t been able to reconnect to the odds producer in ~10 minutes, stop all markets for all sport_events for this odds producer as soon as possible. |