Class LiveScoutUserRequestManagerImpl
java.lang.Object
com.sportradar.livedata.sdk.proto.common.RequestProducerBase<OutgoingMessage>
com.sportradar.livedata.sdk.feed.livescout.classes.LiveScoutUserRequestManagerImpl
- All Implemented Interfaces:
UserRequestManager
,MessageProcessor<LiveScoutEntityBase>
,LiveScoutUserRequestManager
,RequestProducer<OutgoingMessage>
public class LiveScoutUserRequestManagerImpl
extends RequestProducerBase<OutgoingMessage>
implements LiveScoutUserRequestManager, MessageProcessor<LiveScoutEntityBase>
A
UserRequestManager
implementation associated with the live-scout feed.
Also handles error recovery for the feed-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
protected final SdkLogger
SDK loggerstatic final org.joda.time.Duration
How long to leave match after it comes into terminal state? -
Constructor Summary
ConstructorsConstructorDescriptionLiveScoutUserRequestManagerImpl
(int index, LiveScoutOutgoingMessageFactory requestFactory, org.joda.time.Duration maxAge, TestManager testManager) Initializes a new instance of theLiveScoutUserRequestManagerImpl
class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
bookMatches
(EventIdentifier[] eventIds) Book the specified matches.int
getIndex()
Gets the index of the currentMessageProcessor
implementation used to determine the correct order of message processors when there are multiple message processors processing the same message.void
getMatchList
(int hoursBack, int hoursForward, boolean includeAvailable, Collection<Integer> sportIds, Collection<Long> matchIds, UUID requestId) Get a list of matchesGets the ids of all subscribed events.When connected to the test server you can obtain a manager to manipulate it.void
Instructs theRequestProducer
to start generating requests.void
Instructs theRequestProducer
to stop generating requests;void
processMessage
(LiveScoutEntityBase message) Processes the passed message derived fromLiveScoutEntityBase
class.void
Makes a server time request.void
Sets theMessageProcessorListener
instance used to observe the currentMessageProcessor
void
subscribe
(EventIdentifier... eventIds) Subscribe to specified matches.void
unsubscribe
(EventIdentifier... eventIds) Un-subscribe from the specified matches.Methods inherited from class com.sportradar.livedata.sdk.proto.common.RequestProducerBase
getIsStarted, notifyOnRequestReady, notifyOnRequestReady, setListener, start, stop
-
Field Details
-
TERMINAL_STATE_ADDENDUM
public static final org.joda.time.Duration TERMINAL_STATE_ADDENDUMHow long to leave match after it comes into terminal state? -
MAX_SUBSCRIPTION_AMOUNT
public static final int MAX_SUBSCRIPTION_AMOUNT- See Also:
-
sdkLogger
SDK logger
-
-
Constructor Details
-
LiveScoutUserRequestManagerImpl
public LiveScoutUserRequestManagerImpl(int index, LiveScoutOutgoingMessageFactory requestFactory, org.joda.time.Duration maxAge, TestManager testManager) Initializes a new instance of theLiveScoutUserRequestManagerImpl
class.- Parameters:
index
- index in pipelinerequestFactory
- ALiveScoutOutgoingMessageFactory
instance used to generate server requests.maxAge
- max age of eventstestManager
- test manager- Throws:
IllegalArgumentException
- TherequestFactory
is a null reference.
-
-
Method Details
-
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:
bookMatches
in interfaceUserRequestManager
- Parameters:
eventIds
- The id of events to book
-
getSubscribedEvents
Gets the ids of all subscribed events.- Specified by:
getSubscribedEvents
in interfaceUserRequestManager
- Returns:
- the ids of all subscribed events.
-
getTestManager
When connected to the test server you can obtain a manager to manipulate it.- Specified by:
getTestManager
in interfaceUserRequestManager
- Returns:
- a
TestManager
implementation
-
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 start-up or no data will be received.- Specified by:
subscribe
in 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:
unsubscribe
in interfaceUserRequestManager
- Parameters:
eventIds
- Array of match ids from which to un-subscribe
-
getIndex
public int getIndex()Gets the index of the currentMessageProcessor
implementation used to determine the correct order of message processors when there are multiple message processors processing the same message.- Specified by:
getIndex
in interfaceMessageProcessor<LiveScoutEntityBase>
- Returns:
- the index of the current
MessageProcessor
implementation
-
processMessage
Description copied from interface:MessageProcessor
Processes the passed message derived fromLiveScoutEntityBase
class.- Specified by:
processMessage
in interfaceMessageProcessor<LiveScoutEntityBase>
- Parameters:
message
- TheLiveScoutEntityBase
derived class representing the message.
-
setListener
Description copied from interface:MessageProcessor
Sets theMessageProcessorListener
instance used to observe the currentMessageProcessor
- Specified by:
setListener
in interfaceMessageProcessor<LiveScoutEntityBase>
- Parameters:
listener
- TheMessageProcessorListener
used to observe the processor.
-
getMatchList
public void getMatchList(int hoursBack, int hoursForward, boolean includeAvailable, Collection<Integer> sportIds, Collection<Long> matchIds, UUID requestId) Get a list of matches- Specified by:
getMatchList
in interfaceLiveScoutUserRequestManager
- 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)sportIds
- - filter by sports ids, nullablematchIds
- - filter by matches ids, nullablerequestId
- - UUID to track matchlist request
-
requestServerTime
public void requestServerTime()Makes a server time request.- Specified by:
requestServerTime
in interfaceLiveScoutUserRequestManager
-
onStarting
public void onStarting()Instructs theRequestProducer
to start generating requests.- Overrides:
onStarting
in classRequestProducerBase<OutgoingMessage>
-
onStopping
public void onStopping()Instructs theRequestProducer
to stop generating requests;- Overrides:
onStopping
in classRequestProducerBase<OutgoingMessage>
-