Class UnregisteredClient

java.lang.Object
io.iworkflow.core.UnregisteredClient

public class UnregisteredClient extends Object
UntypedClient will let you invoke the APIs to iWF server without much type validation checks(workflow type, signalChannelName, etc). It's useful for calling Client APIs without workflow registry(which may require to have all the workflow dependencies)
  • Constructor Details

    • UnregisteredClient

      public UnregisteredClient(ClientOptions clientOptions)
    • UnregisteredClient

      public UnregisteredClient(ClientOptions clientOptions, DefaultApi openApiClient)
  • Method Details

    • getLastOutgoingWorkflowRpcRequest

      public WorkflowRpcRequest getLastOutgoingWorkflowRpcRequest()
    • startWorkflow

      public String startWorkflow(String workflowType, String startStateId, String workflowId, int workflowTimeoutSeconds)
      Parameters:
      workflowType - required
      startStateId - required
      workflowId - required
      workflowTimeoutSeconds - required
      Returns:
      runId
    • startWorkflow

      public String startWorkflow(String workflowType, String startStateId, String workflowId, int workflowTimeoutSeconds, Object input)
      Parameters:
      workflowType - required
      startStateId - required
      workflowId - required
      workflowTimeoutSeconds - required
      input - optional, can be null
      Returns:
      runId
    • startWorkflow

      public String startWorkflow(String workflowType, String startStateId, String workflowId, int workflowTimeoutSeconds, Object input, UnregisteredWorkflowOptions options)
      Parameters:
      workflowType - required
      startStateId - required
      workflowId - required
      workflowTimeoutSeconds - required
      input - optional, can be null
      options - optional, can be null
      Returns:
      runId
    • getSimpleWorkflowResultWithWait

      public <T> T getSimpleWorkflowResultWithWait(Class<T> valueClass, String workflowId, String workflowRunId)
      For most cases, a workflow only has one result(one completion state). Use this API to retrieve the output of the state with waiting for the workflow to complete. If the workflow is not COMPLETED, throw the FeignException.FeignClientException.
      Type Parameters:
      T - type of the output
      Parameters:
      valueClass - required, the type class of the output
      workflowId - required, the workflowId
      workflowRunId - optional, can be empty
      Returns:
      the output result
    • getSimpleWorkflowResultWithWait

      public <T> T getSimpleWorkflowResultWithWait(Class<T> valueClass, String workflowId)
      For most cases, a workflow only has one result(one completion state). Use this API to retrieve the output of the state with waiting for the workflow to complete. If the workflow is not COMPLETED, throw the FeignException.FeignClientException.
      Type Parameters:
      T - type of the output
      Parameters:
      valueClass - required, the type class of the output
      workflowId - required, the workflowId
      Returns:
      the output result
    • tryGettingSimpleWorkflowResult

      public <T> T tryGettingSimpleWorkflowResult(Class<T> valueClass, String workflowId, String workflowRunId)
      For most cases, a workflow only has one result(one completion state). Use this API to retrieve the output of the state without waiting for the workflow to complete. If the workflow is not COMPLETED, throw the WorkflowUncompletedException. Else, return the same result as getSimpleWorkflowResultWithWait(Class, String, String).
      Type Parameters:
      T - type of the output
      Parameters:
      valueClass - required, the type class of the output
      workflowId - required, the workflowId
      workflowRunId - optional, can be empty
      Returns:
      the output result
    • tryGettingSimpleWorkflowResult

      public <T> T tryGettingSimpleWorkflowResult(Class<T> valueClass, String workflowId)
      For most cases, a workflow only has one result(one completion state). Use this API to retrieve the output of the state without waiting for the workflow to complete. If the workflow is not COMPLETED, throw the WorkflowUncompletedException. Else, return the same result as getSimpleWorkflowResultWithWait(Class, String).
      Type Parameters:
      T - type of the output
      Parameters:
      valueClass - required, the type class of the output
      workflowId - required, the workflowId
      Returns:
      the output result
    • getComplexWorkflowResultWithWait

      public List<StateCompletionOutput> getComplexWorkflowResultWithWait(String workflowId, String workflowRunId)
      In some cases, a workflow may have more than one completion states. Use this API to retrieve the output of the states with waiting for the workflow to complete. If the workflow is not COMPLETED, throw the FeignException.FeignClientException.
      Parameters:
      workflowId - required, the workflowId
      workflowRunId - optional, can be empty
      Returns:
      a list of the state output for completion states. User code will figure how to use ObjectEncoder to decode the output
    • getComplexWorkflowResultWithWait

      public List<StateCompletionOutput> getComplexWorkflowResultWithWait(String workflowId)
      In some cases, a workflow may have more than one completion states. Use this API to retrieve the output of the states with waiting for the workflow to complete. If the workflow is not COMPLETED, throw the FeignException.FeignClientException.
      Parameters:
      workflowId - required, the workflowId
      Returns:
      a list of the state output for completion states. User code will figure how to use ObjectEncoder to decode the output
    • tryGettingComplexWorkflowResult

      public List<StateCompletionOutput> tryGettingComplexWorkflowResult(String workflowId, String workflowRunId)
      In some cases, a workflow may have more than one completion states. Use this API to retrieve the output of the states without waiting for the workflow to complete. If the workflow is not COMPLETED, throw the WorkflowUncompletedException. Else, return the same result as getComplexWorkflowResultWithWait(String, String).
      Parameters:
      workflowId - required, the workflowId
      workflowRunId - optional, can be empty
      Returns:
      a list of the state output for completion states. User code will figure how to use ObjectEncoder to decode the output
    • tryGettingComplexWorkflowResult

      public List<StateCompletionOutput> tryGettingComplexWorkflowResult(String workflowId)
      In some cases, a workflow may have more than one completion states. Use this API to retrieve the output of the states without waiting for the workflow to complete. If the workflow is not COMPLETED, throw the WorkflowUncompletedException. Else, return the same result as getComplexWorkflowResultWithWait(String).
      Parameters:
      workflowId - required, the workflowId
      Returns:
      a list of the state output for completion states. User code will figure how to use ObjectEncoder to decode the output
    • waitForStateExecutionCompletion

      public void waitForStateExecutionCompletion(String workflowId, String stateExecutionId)
    • waitForStateExecutionCompletion

      public void waitForStateExecutionCompletion(String workflowId, String stateId, String waitForKey)
    • signalWorkflow

      public void signalWorkflow(String workflowId, String workflowRunId, String signalChannelName, Object signalValue)
    • resetWorkflow

      public String resetWorkflow(String workflowId, String workflowRunId, ResetWorkflowTypeAndOptions resetWorkflowTypeAndOptions)
      Parameters:
      workflowId - workflowId
      workflowRunId - workflowRunId
      resetWorkflowTypeAndOptions - the combination parameter for reset
      Returns:
      the new runId after reset
    • skipTimer

      public void skipTimer(String workflowId, String workflowRunId, String workflowStateId, int stateExecutionNumber, String timerCommandId)
    • skipTimer

      public void skipTimer(String workflowId, String workflowRunId, String workflowStateId, int stateExecutionNumber, int timerCommandIndex)
    • stopWorkflow

      public void stopWorkflow(String workflowId, String workflowRunId)
      Stop a workflow, this is essentially cancel the workflow gracefully
      Parameters:
      workflowId - required
      workflowRunId - optional
    • stopWorkflow

      public void stopWorkflow(String workflowId, String workflowRunId, StopWorkflowOptions options)
      Stop a workflow with options
      Parameters:
      workflowId - required
      workflowRunId - optional
      options - optional
    • getAnyWorkflowDataObjects

      public WorkflowGetDataObjectsResponse getAnyWorkflowDataObjects(String workflowId, String workflowRunId, List<String> attributeKeys)
      Parameters:
      workflowId - workflowId
      workflowRunId - workflowRunId
      attributeKeys - , return all attributes if this is empty or null
      Returns:
      the response
    • getWorkflow

      public WorkflowGetResponse getWorkflow(String workflowId, String workflowRunId, Boolean needsResults)
      Get a workflow's status and results(if completed & requested). If the workflow does not exist, throw the WORKFLOW_NOT_EXISTS_SUB_STATUS exception.
      Parameters:
      workflowId - required
      workflowRunId - optional
      needsResults - result will be returned if this is true and workflow is completed
      Returns:
      the workflow's status and results
    • getAnyWorkflowDataObjects

      public WorkflowGetDataObjectsResponse getAnyWorkflowDataObjects(String workflowId, String workflowRunId, List<String> attributeKeys, boolean usingMemoForDataAttributes)
    • searchWorkflow

      public WorkflowSearchResponse searchWorkflow(String query, int pageSize)
    • searchWorkflow

      public WorkflowSearchResponse searchWorkflow(WorkflowSearchRequest request)
    • getAnyWorkflowSearchAttributes

      public WorkflowGetSearchAttributesResponse getAnyWorkflowSearchAttributes(String workflowId, String workflowRunId, List<SearchAttributeKeyAndType> attributeKeys)
    • invokeRpc

      public <T> T invokeRpc(Class<T> valueClass, Object input, String workflowId, String workflowRunId, String rpcName, int timeoutSeconds, PersistenceLoadingPolicy dataAttributesLoadingPolicy, PersistenceLoadingPolicy searchAttributesLoadingPolicy)
    • invokeRpc

      public <T> T invokeRpc(Class<T> valueClass, Object input, String workflowId, String workflowRunId, String rpcName, int timeoutSeconds, PersistenceLoadingPolicy dataAttributesLoadingPolicy, PersistenceLoadingPolicy searchAttributesLoadingPolicy, boolean usingMemoForDataAttributes, List<SearchAttributeKeyAndType> allSearchAttributes)