See: Description
Then to actually connect and start receiving messages you do the following:
MyUofListener listener = new MyUofListener(); MyUofGlobalEventsListener globalEventsListener = new MyUofGlobalEventsListener(); UofConfiguration config = UofSdk.getUofConfigurationBuilder() .setAccessToken("your-integration-token-here") .selectIntegration() .build(); UofSdk uofSdk = new UofSdk(globalEventsListener, config); UofSessionBuilder sessionBuilder = uofSdk.getSessionBuilder(); sessionBuilder.setListener(listener).setMessageInterest(MessageInterest.AllMessages).build(); uofSdk.open();
See UofSdk, UofSessionBuilder, UofGlobalEventsListener and UofListener for details.
That should be about it!
If you want to get available sport events, active tournaments, or all sports you can get the SportDataProvider from the main UofSdk instance:
SportDataProvider sportDataProvider = uofSdk.getSportDataProvider(); // Get all sports, translated in the desired locales for (Sport sport : sportDataProvider.getSports()) { } // Get all soccer active tournaments, the returned data will be translated in the desired locales for (SportEvent tournament : sportDataProvider.getActiveTournaments("soccer")) { } // Get all competitions scheduled for today for (SportEvent sportEvent : sportDataProvider.getCompetitionsFor(new Date())) { } // Get all live competitions for (SportEvent sportEvent : sportDataProvider.getLiveCompetitions()) { }
Another more scalable way of listening to events is to have two different sessions one for high-priority messages and another for low-priority-messages. This means that the low priority messages will not prevent high-priority messages from getting processed (ex., BetSettlement is considered low-priority, OddsChange is considered high-priority). To create two different sessions for the high and low-priority messages you do the following:
MyUofListener listener = new MyUofListener(); MyUofGlobalEventsListener globalEventsListener = new MyUofGlobalEventsListener(); UofConfiguration config = UofSdk.getUofConfigurationBuilder() .setAccessToken("your-integration-token-here") .selectIntegration() .build(); UofSdk uofSdk = new UofSdk(globalEventsListener, config); UofSessionBuilder sessionBuilder = uofSdk.getSessionBuilder(); sessionBuilder.setListener(listener).setMessageInterest(MessageInterest.HiPrioMessagesOnly).build(); sessionBuilder.setListener(listener).setMessageInterest(MessageInterest.LoPrioMessagesOnly).build(); uofSdk.open();Note that the same listener is used for both channels, but when creating the two different sessions, different MessageInterest levels are provided. In this case, you will get two different threads doing the processing of the different types of messages.
sessionBuilder.setListener(listener).setMessageInterest(MessageInterest.LiveMessagesOnly).build();This kind of session will receive all messages except OddsChange happening before the game starts (you will start receiving OddsChange some minutes before the game starts) and BetSettlement resulting from confirmed results (you will still receive BetSettlments when the game ends, but only after 15minutes or even later after the game confirms the match results).
If some malfunction of the system is detected(Sportradar subsystem stops working, alive interval violations,...), the SDK will dispatch a ProducerDown event, when this happens it is advised that you disable all the markets related to this producer.
When the SDK detects that the malfunction is corrected it will automatically reconnect and request the most recent odds information and any other missed messages(a recovery request will be executed), after the recovery is completed the ProducerUp event is dispatched, after the producer is up again you can safely re-enable all the markets.
If your system crashes or if you take down/restart your system you need to provide the timestamp of the last processed message per producer, so the SDK performs the recovery for the missed messages(the max time from the last processed message can not be more than 3 days). You can do this trough the ProducerManager available on the UofSdk instance. If the last processed message timestamp is not provided, the SDK will perform a full recovery, beware: with a full recovery you do not recover any lost BetSettlement messages!
// as an example, we set the last message received timestamp to 2 days ago for the producer with the id 1(LiveOdds) Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, -2); ProducerManager producerManager = uofSdk.getProducerManager(); producerManager.setProducerLastMessageTimestamp(1, cal.getTime().getTime()); // session creation,... uofSdk.open(); // finally we open the feed
Copyright © 2016–2025. All rights reserved.