Class DigitalTwinMessageSender

java.lang.Object
com.scaleoutsoftware.digitaltwin.client.DigitalTwinMessageSender

public class DigitalTwinMessageSender extends Object
The DigitalTwinMessageSender sends messages to digital twin models.
  • Constructor Details

    • DigitalTwinMessageSender

      public DigitalTwinMessageSender(com.scaleout.client.GridConnection connection)
      Instantiate the DigitalTwinMessageSender.
      Parameters:
      connection - the GridConnection.
  • Method Details

    • sendToModel

      public CompletableFuture<Void> sendToModel(String modelName, String objectId, byte[] message)
      Sends a messages to a digital twin modul with a default timeout of 5 seconds.
      Parameters:
      modelName - the digital twin model name.
      objectId - the unique digital twin instance id.
      message - the serialized message.
      Returns:
      a CompletableFuture that returns null upon successful completion. If an exception occurs in message processing or the request times out, an exception is reported.
    • sendToModel

      public CompletableFuture<Void> sendToModel(String modelName, String objectId, byte[] message, Duration timeout)
      Sends a message to a digital twin model with a configurable timeout.
      Parameters:
      modelName - the digital twin model name.
      objectId - the unique digital twin instance id.
      message - the serialized message.
      timeout - the duration of time in seconds before a timeout occurs.
      Returns:
      a CompletableFuture that returns null upon successful completion. If an exception occurs in message processing or the request times out, an exception is reported
    • createTwinInstance

      public CompletableFuture<CreateResult> createTwinInstance(String modelName, String objectId, byte[] serializedInstance)
      Create a digital twin instance -- using the default timeout of 5 seconds for the operation.
      Parameters:
      modelName - the digital twin model name.
      objectId - the digital twin instance id to create.
      serializedInstance - the serialized digital twin instance.
      Returns:
      a completable future that will return a CreateResult detailing the operation status or complete exceptionally if an error occurs.
    • createTwinInstance

      public CompletableFuture<CreateResult> createTwinInstance(String modelName, String objectId, byte[] serializedInstance, Duration timeout)
      Create a digital twin instance -- specifying a timeout for the operation.
      Parameters:
      modelName - the digital twin model name.
      objectId - the digital twin instance id to create.
      serializedInstance - the serialized digital twin instance.
      timeout - the duration of time in seconds before a timeout occurs. Timeout value must be between 1 and 60 seconds.
      Returns:
      a completable future that will return a CreateResult detailing the operation status or complete exceptionally if an error occurs.
    • deleteTwinInstance

      public CompletableFuture<DeleteResult> deleteTwinInstance(String modelName, String objectId)
      Delete the target digital twin instance -- using a default timeout of 5 seconds for the operation.
      Parameters:
      modelName - the digital twin model name.
      objectId - the digital twin instance id.
      Returns:
      a future that will complete with a DeleteResult detailing the operation status or complete exceptionally if an error occurred.
    • deleteTwinInstance

      public CompletableFuture<DeleteResult> deleteTwinInstance(String modelName, String objectId, Duration timeout)
      Delete the target digital twin instance -- specifying a timeout for the operation.
      Parameters:
      modelName - the digital twin model name.
      objectId - the digital twin instance id.
      timeout - the duration of time in seconds before a timeout occurs. Timeout value must be between 1 and 60 seconds.
      Returns:
      a future that will complete with a DeleteResult detailing the operation status or complete exceptionally if an error occurred.