Class MsgProcessingContext<O>
java.lang.Object
com.scaleoutsoftware.modules.abstractions.MsgProcessingContext<O>
- Type Parameters:
O- The SOSS object type.
The msg processing context provides access to contextual information during message processing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCache()Retrieve the underlyingCachethat stores objects for the associated module.abstract com.scaleout.client.GridConnectionRetrieve the underlyingGridConnectionused to access the ScaleOut StateServer store.abstract StringRetrieve the module name of the SOSS object.abstract StringRetrieve the unique object ID of the SOSS object.abstract CompletableFuture<Void> sendMessage(String moduleName, String objectId, byte[] message) Asynchronously send a message to a module with the default timeout of 5 seconds.abstract CompletableFuture<Void> sendMessage(String moduleName, String objectId, byte[] message, Duration timeout) Asynchronously send a message to a module.abstract CompletableFuture<Void> sendUiAlert(AlertSeverity severity, String message) Send an alert to the UI.
-
Constructor Details
-
MsgProcessingContext
public MsgProcessingContext()Instantiate a new MsgProcessingContext
-
-
Method Details
-
getModuleName
Retrieve the module name of the SOSS object.- Returns:
- the module name.
-
getObjectId
Retrieve the unique object ID of the SOSS object.- Returns:
- the unique object ID.
-
sendMessage
public abstract CompletableFuture<Void> sendMessage(String moduleName, String objectId, byte[] message) Asynchronously send a message to a module with the default timeout of 5 seconds.- Parameters:
moduleName- the module name of the SOSS object to send the message to.objectId- the object id of the SOSS object to send the message to.message- the serialized message.- Returns:
- a
CompletableFuturethat will complete either due to success (no exception) or an exception occurred. An exception may occur if the recieving module'sMessageProcessorthrows an unhandled exception or the request timed out.
-
sendMessage
public abstract CompletableFuture<Void> sendMessage(String moduleName, String objectId, byte[] message, Duration timeout) Asynchronously send a message to a module.- Parameters:
moduleName- the module name of the SOSS object to send the message to.objectId- the object id of the SOSS object to send the message to.message- the serialized message.timeout- the max duration of this request before the request will timeout.- Returns:
- a
CompletableFuturethat will complete either due to success (no exception) or an exception occurred. An exception may occur if the receiving module'sMessageProcessorthrows an unhandled exception or the request timed out.
-
sendUiAlert
Send an alert to the UI.- Parameters:
severity- theAlertSeverity.message- the message to display.- Returns:
- a
CompletableFuturethat will complete either due to success (no exception) or an exception occurred. An exception may occur if the UI is unavailable.
-
getGridConnection
public abstract com.scaleout.client.GridConnection getGridConnection()Retrieve the underlyingGridConnectionused to access the ScaleOut StateServer store.- Returns:
- the underlying
GridConnection.
-
getCache
Retrieve the underlyingCachethat stores objects for the associated module.- Returns:
- the underlying
Cache.
-