Class MessageProcessor<O>
java.lang.Object
com.scaleoutsoftware.modules.abstractions.MessageProcessor<O>
- Type Parameters:
O- the SOSS object type.
The MessageProcessor is responsible for processing messages and creating objects for sent messages to module objects
that do not yet exist.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract OcreateObject(String moduleName, String id) Create an object for a received messaged for an object that did not exist.abstract NewObjectPolicygetNewObjectPolicy(String moduleName, String id, O object) Generate aNewObjectPolicythat defines theExpirationTypeand expiration timeout.abstract ProcessingResultprocessMessage(MsgProcessingContext<O> msgProcessingContext, O sossObject, byte[] message) Process a message for a SOSS object.
-
Constructor Details
-
MessageProcessor
public MessageProcessor()Instantiate a new MessageProcessor.
-
-
Method Details
-
processMessage
public abstract ProcessingResult processMessage(MsgProcessingContext<O> msgProcessingContext, O sossObject, byte[] message) Process a message for a SOSS object.- Parameters:
msgProcessingContext- theMsgProcessingContext.sossObject- the SOSS object.message- the serialized message.- Returns:
- a
ProcessingResult.ProcessingResult.Removeto remove the object,ProcessingResult.DoUpdateto update the object, andProcessingResult.NoUpdateto indicate that the object was not changed.
-
createObject
Create an object for a received messaged for an object that did not exist.- Parameters:
moduleName- the name of the module.id- the SOSS object id.- Returns:
- the newly created object.
-
getNewObjectPolicy
Generate aNewObjectPolicythat defines theExpirationTypeand expiration timeout. UseDuration.ZEROfor an infinite timeout.- Parameters:
moduleName- the module name.id- the object id.object- the new object.- Returns:
- the
NewObjectPolicy.
-