Class LiveScoutFeedImpl
- All Implemented Interfaces:
UserRequestManager,LiveScoutFeed
LiveScoutFeed implementation used to manage live-scout feed.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLiveScoutFeedImpl(ProtocolManager<OutgoingMessage, LiveScoutEntityBase> protocolManager, LiveScoutUserRequestManager userRequestManager, LiveScoutDispatcher dispatcher, LiveScoutSettings settings) Initializes a new instance of theLiveScoutFeedImplclass. -
Method Summary
Modifier and TypeMethodDescriptionvoidbookMatches(EventIdentifier[] eventIds) Book the specified matches.voidclose()Closes the communication channel with the live-scout server.final voiddispose()Closes the current feed, and disposes all resources associated with it.Holds data about underlying connection parametersvoidgetMatchList(int hoursBack, int hoursForward, boolean includeAvailable) Get a list of matchesvoidgetMatchList(int hoursBack, int hoursForward, boolean includeAvailable, Collection<Integer> sportIds, Collection<Long> matchIds) Requests a list of available scout matches for a given time frame.voidgetMatchList(int hoursBack, int hoursForward, boolean includeAvailable, Collection<Integer> sportIds, Collection<Long> matchIds, UUID requestId) Requests a list of available scout matches for a given time frame.voidgetMatchList(int hoursBack, int hoursForward, boolean includeAvailable, UUID requestId) Get a list of matchesGets the ids of all subscribed matches.When connected to the test server you can obtain a manager to manipulate it.booleanisOpened()Gets the value specifying whether the current feed is openedvoidopen(LiveScoutFeedListener listener) Opens the communication channel with the live-scout servervoidMakes a server time request.voidsubscribe(EventIdentifier[] eventIds) Subscribe to specified matches.voidsubscribeToTest(EventIdentifier eventId, Integer messageDelay, Integer startMessage) Request a full feed for the match, and then update messages will follow in the same pace as they were sent out live.voidunsubscribe(EventIdentifier[] eventIds) Un-subscribe from the specified matches.
-
Field Details
-
lock
Object lock to ensure closing of the feed is called only once -
sdkLogger
Sdk logging facility.
-
-
Constructor Details
-
LiveScoutFeedImpl
public LiveScoutFeedImpl(ProtocolManager<OutgoingMessage, LiveScoutEntityBase> protocolManager, LiveScoutUserRequestManager userRequestManager, LiveScoutDispatcher dispatcher, LiveScoutSettings settings) Initializes a new instance of theLiveScoutFeedImplclass.- Parameters:
protocolManager- AProtocolManagerimplementation used to manage the underlying protocol and related componentsuserRequestManager- TheUserRequestManagerused to process user requests.dispatcher- ALiveScoutDispatcherimplementation used to dispatch messages to the user.settings- Provided settings.- Throws:
IllegalArgumentException- TheprotocolManageris a null reference or auserRequestManageris a null reference or adispatcheris a null reference.
-
-
Method Details
-
isOpened
public boolean isOpened()Gets the value specifying whether the current feed is opened- Specified by:
isOpenedin interfaceLiveScoutFeed- Returns:
- the value specifying whether the current feed is opened
-
open
Opens the communication channel with the live-scout server- Specified by:
openin interfaceLiveScoutFeed- Parameters:
listener- TheLiveScoutFeedListenerinstance used to observe the currentLiveScoutFeed
-
getConnectionParams
Description copied from interface:LiveScoutFeedHolds data about underlying connection parameters- Specified by:
getConnectionParamsin interfaceLiveScoutFeed- Returns:
- feed connection parameters
-
getMatchList
public void getMatchList(int hoursBack, int hoursForward, boolean includeAvailable, Collection<Integer> sportIds, Collection<Long> matchIds) Requests a list of available scout matches for a given time frame.
By default only matches you have access to will be sent. You can also request all available matches by setting theincludeAvailableIf this is done the reply will also include matches that are open for booking.- Specified by:
getMatchListin interfaceLiveScoutFeed- Parameters:
hoursBack- Specifies the open of the time framehoursForward- Specifies the end of the time frameincludeAvailable- Specifies whether matches available for booking should be includedsportIds- - filter by sports ids, nullablematchIds- - filter by matches ids, nullable
-
getMatchList
public void getMatchList(int hoursBack, int hoursForward, boolean includeAvailable) Description copied from interface:LiveScoutFeedGet a list of matches- Specified by:
getMatchListin interfaceLiveScoutFeed- Parameters:
hoursBack- - number of hours back (from current time)hoursForward- - number of hours forward (from current time)includeAvailable- - include also available matches (which you have not booked yet)
-
getMatchList
Description copied from interface:LiveScoutFeedGet a list of matches- Specified by:
getMatchListin interfaceLiveScoutFeed- Parameters:
hoursBack- - number of hours back (from current time)hoursForward- - number of hours forward (from current time)includeAvailable- - include also available matches (which you have not booked yet)requestId- - matchlist request id
-
getMatchList
public void getMatchList(int hoursBack, int hoursForward, boolean includeAvailable, Collection<Integer> sportIds, Collection<Long> matchIds, UUID requestId) Description copied from interface:LiveScoutFeedRequests a list of available scout matches for a given time frame. This method can block to prevent going over the server limits. Use this call in non SDK dispatcher thread!By default only matches you have access to will be sent. You can also request all available matches by setting the
includeAvailableIf this is done the reply will also include matches that are open for booking.- Specified by:
getMatchListin interfaceLiveScoutFeed- Parameters:
hoursBack- Specifies the open of the time framehoursForward- Specifies the end of the time frameincludeAvailable- Specifies whether matches available for booking should be includedsportIds- - filter by sports ids, nullablematchIds- - filter by matches ids, nullablerequestId- - matchlist request id
-
requestServerTime
public void requestServerTime()Description copied from interface:LiveScoutFeedMakes a server time request. This method can block to prevent going over the server limits. Use this call in non SDK dispatcher thread!- Specified by:
requestServerTimein interfaceLiveScoutFeed
-
bookMatches
Book the specified matches. Booked matches cannot be cancelled through this interface.You should prefer using the Live Calendar on the Betradar website (http://www.betradar.com) which offers automatic booking for certain types of matches.
Note that booking matches will have a cost depending on the type of agreement you have with Sportradar.
LiveScout: Expect
LiveScoutFeedListener.onMatchBooked(LiveScoutFeed, MatchBookingEntity)message in reply.- Specified by:
bookMatchesin interfaceUserRequestManager- Parameters:
eventIds- The id of events to book
-
getSubscribedEvents
Gets the ids of all subscribed matches.- Specified by:
getSubscribedEventsin interfaceUserRequestManager- Returns:
- the ids of all subscribed matches.
-
subscribe
Subscribe to specified matches. LiveScout: ExpectLiveScoutFeedListener.onMatchUpdateReceived(LiveScoutFeed, MatchUpdateEntity)message is response. If match subscription is successful, a full match update is sent out. Otherwise explanation will be given in the response message (e.g. you do not have access to the match or there are already two open subscriptions for the match). With LiveScout you must explicitly callUserRequestManager.subscribe(EventIdentifier[])at open-up or no data will be received.- Specified by:
subscribein interfaceUserRequestManager- Parameters:
eventIds- Array of event ids
-
unsubscribe
Un-subscribe from the specified matches. After this no more events associated with these matches will be sent. LiveScout: ExpectLiveScoutFeedListener.onMatchStopped(LiveScoutFeed, MatchStopEntity)message in response.- Specified by:
unsubscribein interfaceUserRequestManager- Parameters:
eventIds- Array of event ids from which to un-subscribe
-
subscribeToTest
Request a full feed for the match, and then update messages will follow in the same pace as they were sent out live.
This should only be used on the test server.
- Specified by:
subscribeToTestin interfaceLiveScoutFeed- Parameters:
eventId- The id of the event.messageDelay- Specifies how many milliseconds to wait between sending out each messagestartMessage- Specifies which message to open replay on (how far into the match). IfstartMessageis greater than or equal to the number of messages for the match, a full feed for the finished match is sent out, and no more messages will follow after this.
-
getTestManager
When connected to the test server you can obtain a manager to manipulate it.- Specified by:
getTestManagerin interfaceUserRequestManager- Returns:
- a
TestManagerimplementation
-
close
public void close()Closes the communication channel with the live-scout server.- Specified by:
closein interfaceLiveScoutFeed
-
dispose
public final void dispose()Closes the current feed, and disposes all resources associated with it. Once the feed is disposed, it can n longer be used.- Specified by:
disposein interfaceLiveScoutFeed
-