public interface MessageProcessor<MessageT extends Message<MessageResponseT>,MessageResponseT extends MessageResponse>
MessageProcessor interface defines methods which allow its implementations to do the
actual work of processing a concrete type of Message implementation and produce a
response that is a concrete implementation of MessageResponse.
Clients of this framework should implement a concrete implementation of this interface for each
distinct type of Message/MessageResponse pair.
Warning! Implementations of this interface must account for the fact that the execution of its code might happen in a multi-threaded environment. Do NOT assume that a new instance of this processor will be created for each thread. In other words, multiple threads might share the same instance of the processor.
| Modifier and Type | Method and Description |
|---|---|
Class<MessageT> |
getCompatibleMessageClassType()
Retrieves class type of the message this processor is to able to process.
|
Class<MessageResponseT> |
getCompatibleMessageResponseClassType()
Retrieves class type of the message response this processor is set to return.
|
String |
getCompatibleMessageType()
Retrieves message type identifier that this processor is able to process.
|
MessageResponseT |
process(MessageT message)
Executes the
message, producing message response of class type which is embedded
in the type of message. |
MessageResponseT process(MessageT message)
message, producing message response of class type which is embedded
in the type of message.message - Message object containing data which is needed for processing this message.message.String getCompatibleMessageType()
The type identifier must be unique system-wide and be identical to the value returned by
the Message.getType() method which is generically typed in the concrete implementation
of this processor.
Message this processor is typed with.Class<MessageT> getCompatibleMessageClassType()
Class<MessageResponseT> getCompatibleMessageResponseClassType()
Copyright © 2018. All rights reserved.