java.lang.Object
com.inductiveautomation.ignition.common.script.message.SendRequestHandle
All Implemented Interfaces:
MessageResultHandler, Request, RequestWatcher

public class SendRequestHandle extends Object implements Request, MessageResultHandler
This only exists because we want to hide the completion functions from the scripting system, so we break it out to a different interface (MessageResultHandler).

A handle to an asynchronous request that allows for blocking, cancellation, and result handling via callbacks.

  • Constructor Details

    • SendRequestHandle

      public SendRequestHandle(CompletableFuture<Object> future)
    • SendRequestHandle

      public SendRequestHandle(int timeout)
  • Method Details

    • block

      public boolean block()
      Description copied from interface: RequestWatcher
      Blocks until the request is complete.
      Specified by:
      block in interface RequestWatcher
      Returns:
      true if the request completed successfully, false if it failed or was cancelled.
    • errorResult

      public void errorResult(Exception e)
      Description copied from interface: MessageResultHandler
      Called when the request fails with an error.
      Specified by:
      errorResult in interface MessageResultHandler
      Parameters:
      e - The exception that occurred.
    • successResult

      public void successResult(Object v)
      Description copied from interface: MessageResultHandler
      Called when the request completes successfully.
      Specified by:
      successResult in interface MessageResultHandler
      Parameters:
      v - The result of the request.
    • get

      public Object get() throws Exception
      Description copied from interface: Request
      Blocks until the request is complete and returns the result.
      Specified by:
      get in interface Request
      Returns:
      The result of the request.
      Throws:
      Exception - If an error occurred during request execution.
    • cancel

      public void cancel()
      Description copied from interface: Request
      Cancels the request.
      Specified by:
      cancel in interface Request
    • getError

      public Exception getError()
      Description copied from interface: Request
      Returns the error that occurred during request execution, if any.
      Specified by:
      getError in interface Request
      Returns:
      The exception, or null if no error occurred.
    • onSuccess

      public void onSuccess(org.python.core.PyObject func)
      Description copied from interface: Request
      Registers a callback to be executed when the request completes successfully.
      Specified by:
      onSuccess in interface Request
      Parameters:
      func - The Python function to call with the result.
    • onError

      public void onError(org.python.core.PyObject func)
      Description copied from interface: Request
      Registers a callback to be executed when the request fails.
      Specified by:
      onError in interface Request
      Parameters:
      func - The Python function to call with the exception.
    • compose

      public RequestWatcher compose(RequestWatcher... requestWatchers)
      Description copied from interface: RequestWatcher
      Composes this request with others into a single watcher.
      Specified by:
      compose in interface RequestWatcher
      Parameters:
      requestWatchers - The other watchers to compose with.
      Returns:
      A new RequestWatcher that tracks all provided requests.
    • toString

      public String toString()
      Overrides:
      toString in class Object