Class LiveFeedProtocolManager
java.lang.Object
com.sportradar.livedata.sdk.feed.common.LiveFeedProtocolManager
- All Implemented Interfaces:
- ProtocolManager<OutgoingMessage,- LiveScoutEntityBase> 
public class LiveFeedProtocolManager
extends Object
implements ProtocolManager<OutgoingMessage,LiveScoutEntityBase> 
A 
ProtocolManager implementation used to manage protocol which connects to a live-feed- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionLiveFeedProtocolManager(Protocol<IncomingMessage, OutgoingMessage> protocol, EntityMapper<IncomingMessage, LiveScoutEntityBase> entityMapper, MessageProcessor<LiveScoutEntityBase> messageProcessor, RequestProducer<OutgoingMessage> requestProducer) Initializes a new instance of theLiveFeedProtocolManagerclass
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes the underlying protocolprotected voidNotifies the observer that the connection to the server was dropped.protected final voidNotifies the observer that the protocol has successfully logged in to the server.protected final voidNotifies the observer that new message was received.voidopen()Opens the underlying protocolprotected voidprocessMessage(IncomingMessage message) Processes the received messagevoidReconnects the underlying feedprotected booleansendMessage(OutgoingMessage message, boolean blocking) Sends the passedOutgoingMessageinstance to the server.voidsendMessage(String data) Sends the passed string representation of the message to the server.voidSets the listener used to observe the currentProtocolManager.
- 
Field Details- 
sdkloggerTheSdkLoggerimplementation used for structured logging.
 
- 
- 
Constructor Details- 
LiveFeedProtocolManagerpublic LiveFeedProtocolManager(Protocol<IncomingMessage, OutgoingMessage> protocol, EntityMapper<IncomingMessage, LiveScoutEntityBase> entityMapper, MessageProcessor<LiveScoutEntityBase> messageProcessor, RequestProducer<OutgoingMessage> requestProducer) Initializes a new instance of theLiveFeedProtocolManagerclass- Parameters:
- protocol- The- Protocolimplementation used to communicate with the target feed.
- entityMapper- The- EntityMapperimplementation used to map received messages to feed entities.
- messageProcessor- The- MessageProcessorused to process incoming messages
- requestProducer- The- RequestProducerimplementation which produces message to be send to the server.
 
 
- 
- 
Method Details- 
closepublic void close()Closes the underlying protocol- Specified by:
- closein interface- ProtocolManager<OutgoingMessage,- LiveScoutEntityBase> 
 
- 
openpublic void open()Opens the underlying protocol- Specified by:
- openin interface- ProtocolManager<OutgoingMessage,- LiveScoutEntityBase> 
 
- 
reconnectpublic void reconnect()Description copied from interface:ProtocolManagerReconnects the underlying feed- Specified by:
- reconnectin interface- ProtocolManager<OutgoingMessage,- LiveScoutEntityBase> 
 
- 
sendMessageSends the passed string representation of the message to the server.- Specified by:
- sendMessagein interface- ProtocolManager<OutgoingMessage,- LiveScoutEntityBase> 
- Parameters:
- data- - The- Stringto be send to the server.
 
- 
setListenerSets the listener used to observe the currentProtocolManager.- Specified by:
- setListenerin interface- ProtocolManager<OutgoingMessage,- LiveScoutEntityBase> 
- Parameters:
- listener- The- ProtocolManagerListenerused to observe the- ProtocolManager
 
- 
notifyOnDisconnectedprotected void notifyOnDisconnected()Notifies the observer that the connection to the server was dropped.
- 
notifyOnLoggedInprotected final void notifyOnLoggedIn()Notifies the observer that the protocol has successfully logged in to the server.
- 
notifyOnMessageReceivedNotifies the observer that new message was received.- Parameters:
- message- The- LiveScoutEntityBasederived instance representing the received message.
 
- 
processMessageProcesses the received message- Parameters:
- message- The- IncomingMessagerepresenting the received message.
 
- 
sendMessageSends the passedOutgoingMessageinstance to the server.- Parameters:
- message- the- OutgoingMessageinstance to be send to the server.
- blocking- mark if request must be blocking.
- Returns:
- true if success.
- Throws:
- IllegalArgumentException- the- messageis a null reference.
- IllegalStateException- the message cannot be send at this time.
 
 
-