Class MsgProcessingContext<O>

java.lang.Object
com.scaleoutsoftware.modules.abstractions.MsgProcessingContext<O>
Type Parameters:
O - The SOSS object type.

public abstract class MsgProcessingContext<O> extends Object
The msg processing context provides access to contextual information during message processing.
  • Constructor Details

    • MsgProcessingContext

      public MsgProcessingContext()
      Instantiate a new MsgProcessingContext
  • Method Details

    • getModuleName

      public abstract String getModuleName()
      Retrieve the module name of the SOSS object.
      Returns:
      the module name.
    • getObjectId

      public abstract String 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 CompletableFuture that will complete either due to success (no exception) or an exception occurred. An exception may occur if the recieving module's MessageProcessor throws 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 CompletableFuture that will complete either due to success (no exception) or an exception occurred. An exception may occur if the receiving module's MessageProcessor throws an unhandled exception or the request timed out.
    • sendUiAlert

      public abstract CompletableFuture<Void> sendUiAlert(AlertSeverity severity, String message)
      Send an alert to the UI.
      Parameters:
      severity - the AlertSeverity.
      message - the message to display.
      Returns:
      a CompletableFuture that 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 underlying GridConnection used to access the ScaleOut StateServer store.
      Returns:
      the underlying GridConnection.
    • getCache

      public abstract com.scaleout.client.caching.Cache<String,O> getCache()
      Retrieve the underlying Cache that stores objects for the associated module.
      Returns:
      the underlying Cache.