Betradar - the betting arm of Sportradar
Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Anchor | ||||
---|---|---|---|---|
|
Excerpt Include | ||||||
---|---|---|---|---|---|---|
|
Excerpt Include | ||||||
---|---|---|---|---|---|---|
|
Panel | |||
---|---|---|---|
The Unified Odds SDK (Software developer kit) provides a simple and efficient way for bookmakers to access Betradar's odds and sport information. It combines subscription of messages and API calls into a unified Java or .NET interface that hides most of the complexity, including recovery. Table of contents
Main SDK benefits over protocol/API
Getting started with the SDKIn order to get started quickly with the SDK, we suggest using the example projects which can be obtained from our SDK websites (please check above). Main components of the SDKThe following components are mainly used in the SDK. Please note that names of classes and interfaces can slightly differ between Java and .NET, but mostly do provide the same functionalities. ConfigurationBefore the SDK can connect to the feed and starts processing messages it has to be properly configured. The configuration must contain various information from the access token used to authenticate with the feed to various user preferences like default language, supported languages, ... The SDK supports both in-code and (external) file-based configuration. The configuration uses a builder pattern forcing the user to set mandatory values while allowing to skip optional ones. Various builders are used to create different configurations which target different environments:
SessionsA session represents a channel of communication with the AMQP broker. Each session runs in its own thread meaning that messages received by different sessions are processed in different threads. The threads are owned by the component used to communicate with the feed, meaning that long-running operations should not be invoked on those threads because this blocks receiving new messages on that session. More than one session can be created on each feed instance. The session itself cannot be opened or closed (started or stopped) it opens/closes when the associated feed object is opened/closed. When building a session, a message interest specifying the session scope must be provided. Message interest specifies which messages will be received by the associated session. Only certain combinations of messageinterest/session combinations are permitted
RecoveryThe recovery operation ensures that the state of the SDK (and therefore the system using the SDK) is in-sync with the state of the feed. Whether a given producer is in-sync with the feed can be determined by invoking an appropriate method on the producer object. Each time the state of the producer changes, the user is notified via global event / callback. When the SDK starts, the recovery needs to be initiated in order to get the current state. Since the SDK does not persist any information, a user must provide a timestamp from which the recovery will be made (a setProducerRecoveryFromTimestamp method in Java & AddTimestampBeforeDisconnect method in .Net). No additional action from the user is required to ensure the state of the SDK is in-sync with the state of the feed. Once the recovery is made and the producer is "marked as up", the "recovery timestamp" can be determined by calling an appropriate method on the producer object(getTimestampForRecovery in Java & LastTimestampBeforeDisconnect in .Net). This value should be periodically retrieved and stored to ensure it is available and up-to-date in case a restart of the system is required. The recovery operations have a time limit - indicating the maximum time window in which they need to complete. If the recovery is not completed in a specified time window, it is automatically restarted by the SDK. The maximum recovery time can be configured via SDK configuration. LoggingThe SDK logging component is configured via configuration file for the selected logging platform. The examples available on the http://sdk.sportradar.com use logback(Java version) and log4net(.net version) and can be used as reference for configuration of those two logging platforms. The actual logging platform must be provided by the user via dependency management system. Since .Net does not provide a logging facade (equivalent of SLF4J in java) an open-source library Common.Logging is used. Since investigation of possible SDK issues relies on the logs generated by the SDK, the users are encouraged to keep the logs for longer periods and have them configured to log as much information as possible (especially during the integration). SDK logs data to multiple files and different levels can be assigned to different loggers.
Error handlingSDK exception handling can be configured via the SDK configuration. By default, any exception thrown during the exection of a publicly available method is caught by the SDK and a null reference is returned to the user. When the config option is set to "throw", all exceptions are propagated to the caller. For more information see the ExceptionHandlingStrategy enum. The exception to this rule are methods on the feed object which are called before the feed is opened - most notably the open method in java and Open in .Net. Those two methods always throw an exception if the connection to the feed cannot be established. Hierarchy of types representing sport eventsThe SDK exposes a number of types used to represent different types of sport events(matches, seasons, competitions,...). When event specific message dispatchment is not used, the the sport event is represented by it's base type and needs to be type-casted into a more specific type. The class diagram below, shows all interfaces derived from the sport event along with methods defined on each one. |
HideElements | ||||||
---|---|---|---|---|---|---|
|