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 multipleMessageProcessor
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
Constructors Constructor Description MessagePipeline(int index, MessageProcessor<T>... processors)
Initializes a new instance of theMessagePipeline
class from the passedMessageProcessor
instances.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
processMessage(T message)
Processes the passed message derived fromLiveScoutEntityBase
class.void
setListener(MessageProcessorListener<T> listener)
Sets theMessageProcessorListener
instance used to observe the currentMessageProcessor
-
-
-
Constructor Detail
-
MessagePipeline
@SafeVarargs public MessagePipeline(int index, MessageProcessor<T>... processors)
Initializes a new instance of theMessagePipeline
class from the passedMessageProcessor
instances.- Parameters:
index
- the index of the currentMessageProcessor
implementationprocessors
- theMessageProcessor
instances from which the pipeline will be composed.
-
-
Method Detail
-
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<T extends LiveScoutEntityBase>
- Returns:
- the index of the current
MessageProcessor
implementation
-
processMessage
public void processMessage(T message)
Processes the passed message derived fromLiveScoutEntityBase
class.- Specified by:
processMessage
in interfaceMessageProcessor<T extends LiveScoutEntityBase>
- Parameters:
message
- TheLiveScoutEntityBase
derived class representing the message.- Throws:
IllegalArgumentException
- themessage
is a null reference.
-
setListener
public void setListener(MessageProcessorListener<T> listener)
Sets theMessageProcessorListener
instance used to observe the currentMessageProcessor
- Specified by:
setListener
in interfaceMessageProcessor<T extends LiveScoutEntityBase>
- Parameters:
listener
- TheMessageProcessorListener
used to observe the processor.
-
-