Class ApiModuleClient

java.lang.Object
com.scaleoutsoftware.modules.client.ApiModuleClient

public class ApiModuleClient extends Object
The MsgModuleClient is used to send messages to a client and access the underlying module cache.
  • Constructor Details

    • ApiModuleClient

      public ApiModuleClient(com.scaleout.client.GridConnection connection, String moduleName)
      Default constructor for a ApiModuleClient.
      Parameters:
      connection - the GridConnection to a ScaleOut store.
      moduleName - the API module name.
  • Method Details

    • invoke

      public byte[] invoke(String objectId, String operationId, byte[] operationParams) throws ApiModuleException
      Sends a messages to a module with the default timeout of 5 seconds.
      Parameters:
      objectId - the unique SOSS object id.
      operationId - the module name.
      operationParams - the serialized message.
      Returns:
      The serialized return value of the invoked endpoint or if an exception occurs in message processing or the request times out, an exception is reported
      Throws:
      ApiModuleException - if an exception occurs during the invoke operation. See ApiModuleException for details on causes.
    • invoke

      public byte[] invoke(String objectId, String operationId, byte[] operationParams, Duration timeout) throws ApiModuleException
      Sends a messages to a module with a configurable timeout.
      Parameters:
      objectId - the unique SOSS object id.
      operationId - the module name.
      operationParams - the serialized message.
      timeout - the duration of time in seconds before a timeout occurs.
      Returns:
      The serialized return value of the invoked endpoint or if an exception occurs in message processing or the request times out, an exception is reported
      Throws:
      ApiModuleException - if an exception occurs during the invoke operation. See ApiModuleException for details on causes.
    • invokeAll

      public byte[] invokeAll(String operationId, byte[] operationParams, Duration timeout) throws ApiModuleException
      Invokes a ForEachApiProcessor or ReduceApiProcessor on all objects in a module.
      Parameters:
      operationId - the parallel operation name.
      operationParams - the optional parameters.
      timeout - the invocation timeout.
      Returns:
      A byte[] result, or null if no result exists.
      Throws:
      ApiModuleException - if an exception occurs during processing.