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>
AUserRequestManager
implementation associated with the live-scout feed. Also handles error recovery for the feed
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_SUBSCRIPTION_AMOUNT
protected SdkLogger
sdkLogger
SDK loggerstatic org.joda.time.Duration
TERMINAL_STATE_ADDENDUM
How long to leave match after it comes into terminal state?
-
Constructor Summary
Constructors Constructor Description LiveScoutUserRequestManagerImpl(int index, LiveScoutStatusFactory requestFactory, org.joda.time.Duration maxAge, TestManager testManager)
Initializes a new instance of theLiveScoutUserRequestManagerImpl
class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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<Long> sportIds, Collection<Long> matchIds)
Get a list of matchesEventIdentifier[]
getSubscribedEvents()
Gets the ids of all subscribed events.TestManager
getTestManager()
When connected to the test server you can obtain a manager to manipulate it.void
onStarting()
Instructs theRequestProducer
to start generating requests.void
onStopping()
Instructs theRequestProducer
to stop generating requests;void
processMessage(LiveScoutEntityBase message)
Processes the passed message derived fromLiveScoutEntityBase
class.void
requestServerTime()
Makes a server time request.void
setListener(MessageProcessorListener<LiveScoutEntityBase> listener)
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 Detail
-
TERMINAL_STATE_ADDENDUM
public static final org.joda.time.Duration TERMINAL_STATE_ADDENDUM
How long to leave match after it comes into terminal state?
-
MAX_SUBSCRIPTION_AMOUNT
public static final int MAX_SUBSCRIPTION_AMOUNT
- See Also:
- Constant Field Values
-
sdkLogger
protected final SdkLogger sdkLogger
SDK logger
-
-
Constructor Detail
-
LiveScoutUserRequestManagerImpl
public LiveScoutUserRequestManagerImpl(int index, LiveScoutStatusFactory requestFactory, org.joda.time.Duration maxAge, TestManager testManager)
Initializes a new instance of theLiveScoutUserRequestManagerImpl
class.- Parameters:
index
- index in pipelinerequestFactory
- ALiveScoutStatusFactory
instance used to generate server requests.maxAge
- max age of eventstestManager
- test manager- Throws:
IllegalArgumentException
- TherequestFactory
is a null reference.
-
-
Method Detail
-
bookMatches
public void bookMatches(EventIdentifier[] eventIds)
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
public EventIdentifier[] getSubscribedEvents()
Gets the ids of all subscribed events.- Specified by:
getSubscribedEvents
in interfaceUserRequestManager
- Returns:
- the ids of all subscribed events.
-
getTestManager
public TestManager 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
public void subscribe(EventIdentifier... eventIds)
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
public void unsubscribe(EventIdentifier... eventIds)
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
public void processMessage(LiveScoutEntityBase message)
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
public void setListener(MessageProcessorListener<LiveScoutEntityBase> listener)
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<Long> sportIds, Collection<Long> matchIds)
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, nullable
-
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>
-
-