Class DigitalTwinClient<O extends DigitalTwinBase<O>>

java.lang.Object
com.scaleoutsoftware.digitaltwin.client.DigitalTwinClient<O>
Type Parameters:
O - the type of digital twin.

public class DigitalTwinClient<O extends DigitalTwinBase<O>> extends Object
The DigitalTwinClient is used to create digital twin instances and send messages to digital twin instances.
  • Method Details

    • sendToTwin

      public CompletableFuture<SendingResult> sendToTwin(String objectId, byte[] message)
      Sends a messages to a DigitalTwin instance with a default timeout of 5 seconds.
      Parameters:
      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.
    • sendToTwin

      public CompletableFuture<SendingResult> sendToTwin(String objectId, byte[] message, Duration timeout)
      Sends a messages to a DigitalTwin instance with a configurable timeout.
      Parameters:
      objectId - the unique Digital Twin instance id.
      message - the serialized message.
      timeout - the duration of time in seconds before a timeout occurs. Timeout value must be between 1 and 60 seconds.
      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 objectId, byte[] serializedInstance)
      Create a digital twin instance -- using the default timeout of 5 seconds for the operation.
      Parameters:
      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 objectId, byte[] serializedInstance, Duration timeout)
      Create a digital twin instance -- specifying a timeout for the operation.
      Parameters:
      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 objectId)
      Delete the target digital twin instance -- using a default timeout of 5 seconds for the operation.
      Parameters:
      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 objectId, Duration timeout)
      Delete the target digital twin instance -- specifying a timeout for the operation.
      Parameters:
      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.