Class MessagePipeline<T extends LiveScoutEntityBase>
java.lang.Object
com.sportradar.livedata.sdk.feed.common.MessagePipeline<T>
- All Implemented Interfaces:
MessageProcessor<T>
public class MessagePipeline<T extends LiveScoutEntityBase>
extends Object
implements MessageProcessor<T>
A message - processing pipeline which consists of multiple
MessageProcessor instances.
Each message processor can, after processing the message hand it to the next processor, or can stop
the processing of the current message.- Author:
- uros.bregar
-
Constructor Summary
ConstructorsConstructorDescriptionMessagePipeline(int index, MessageProcessor<T>... processors) Initializes a new instance of theMessagePipelineclass from the passedMessageProcessorinstances. -
Method Summary
Modifier and TypeMethodDescriptionintgetIndex()Gets the index of the currentMessageProcessorimplementation used to determine the correct order of message processors when there are multiple message processors processing the same message.voidprocessMessage(T message) Processes the passed message derived fromLiveScoutEntityBaseclass.voidsetListener(MessageProcessorListener<T> listener) Sets theMessageProcessorListenerinstance used to observe the currentMessageProcessor
-
Constructor Details
-
MessagePipeline
Initializes a new instance of theMessagePipelineclass from the passedMessageProcessorinstances.- Parameters:
index- the index of the currentMessageProcessorimplementationprocessors- theMessageProcessorinstances from which the pipeline will be composed.
-
-
Method Details
-
getIndex
public int getIndex()Gets the index of the currentMessageProcessorimplementation used to determine the correct order of message processors when there are multiple message processors processing the same message.- Specified by:
getIndexin interfaceMessageProcessor<T extends LiveScoutEntityBase>- Returns:
- the index of the current
MessageProcessorimplementation
-
processMessage
Processes the passed message derived fromLiveScoutEntityBaseclass.- Specified by:
processMessagein interfaceMessageProcessor<T extends LiveScoutEntityBase>- Parameters:
message- TheLiveScoutEntityBasederived class representing the message.- Throws:
IllegalArgumentException- themessageis a null reference.
-
setListener
Sets theMessageProcessorListenerinstance used to observe the currentMessageProcessor- Specified by:
setListenerin interfaceMessageProcessor<T extends LiveScoutEntityBase>- Parameters:
listener- TheMessageProcessorListenerused to observe the processor.
-