Package io.iworkflow.core
Class UnregisteredClient
java.lang.Object
io.iworkflow.core.UnregisteredClient
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 Summary
ConstructorsConstructorDescriptionUnregisteredClient
(ClientOptions clientOptions) UnregisteredClient
(ClientOptions clientOptions, DefaultApi openApiClient) -
Method Summary
Modifier and TypeMethodDescriptiongetAnyWorkflowDataObjects
(String workflowId, String workflowRunId, List<String> attributeKeys) getAnyWorkflowDataObjects
(String workflowId, String workflowRunId, List<String> attributeKeys, boolean usingMemoForDataAttributes) getAnyWorkflowSearchAttributes
(String workflowId, String workflowRunId, List<SearchAttributeKeyAndType> attributeKeys) getComplexWorkflowResultWithWait
(String workflowId) In some cases, a workflow may have more than one completion states.getComplexWorkflowResultWithWait
(String workflowId, String workflowRunId) In some cases, a workflow may have more than one completion states.<T> T
getSimpleWorkflowResultWithWait
(Class<T> valueClass, String workflowId) For most cases, a workflow only has one result(one completion state).<T> T
getSimpleWorkflowResultWithWait
(Class<T> valueClass, String workflowId, String workflowRunId) For most cases, a workflow only has one result(one completion state).getWorkflow
(String workflowId, String workflowRunId, Boolean needsResults) Get a workflow's status and results(if completed & requested).<T> T
invokeRpc
(Class<T> valueClass, Object input, String workflowId, String workflowRunId, String rpcName, int timeoutSeconds, PersistenceLoadingPolicy dataAttributesLoadingPolicy, PersistenceLoadingPolicy searchAttributesLoadingPolicy) <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) resetWorkflow
(String workflowId, String workflowRunId, ResetWorkflowTypeAndOptions resetWorkflowTypeAndOptions) searchWorkflow
(WorkflowSearchRequest request) searchWorkflow
(String query, int pageSize) void
signalWorkflow
(String workflowId, String workflowRunId, String signalChannelName, Object signalValue) void
skipTimer
(String workflowId, String workflowRunId, String workflowStateId, int stateExecutionNumber, int timerCommandIndex) void
skipTimer
(String workflowId, String workflowRunId, String workflowStateId, int stateExecutionNumber, String timerCommandId) startWorkflow
(String workflowType, String startStateId, String workflowId, int workflowTimeoutSeconds) startWorkflow
(String workflowType, String startStateId, String workflowId, int workflowTimeoutSeconds, Object input) startWorkflow
(String workflowType, String startStateId, String workflowId, int workflowTimeoutSeconds, Object input, UnregisteredWorkflowOptions options) void
stopWorkflow
(String workflowId, String workflowRunId) Stop a workflow, this is essentially cancel the workflow gracefullyvoid
stopWorkflow
(String workflowId, String workflowRunId, StopWorkflowOptions options) Stop a workflow with optionstryGettingComplexWorkflowResult
(String workflowId) In some cases, a workflow may have more than one completion states.tryGettingComplexWorkflowResult
(String workflowId, String workflowRunId) In some cases, a workflow may have more than one completion states.<T> T
tryGettingSimpleWorkflowResult
(Class<T> valueClass, String workflowId) For most cases, a workflow only has one result(one completion state).<T> T
tryGettingSimpleWorkflowResult
(Class<T> valueClass, String workflowId, String workflowRunId) For most cases, a workflow only has one result(one completion state).void
waitForStateExecutionCompletion
(String workflowId, String stateExecutionId) void
waitForStateExecutionCompletion
(String workflowId, String stateId, String waitForKey)
-
Constructor Details
-
UnregisteredClient
-
UnregisteredClient
-
-
Method Details
-
getLastOutgoingWorkflowRpcRequest
-
startWorkflow
public String startWorkflow(String workflowType, String startStateId, String workflowId, int workflowTimeoutSeconds) - Parameters:
workflowType
- requiredstartStateId
- requiredworkflowId
- requiredworkflowTimeoutSeconds
- required- Returns:
- runId
-
startWorkflow
public String startWorkflow(String workflowType, String startStateId, String workflowId, int workflowTimeoutSeconds, Object input) - Parameters:
workflowType
- requiredstartStateId
- requiredworkflowId
- requiredworkflowTimeoutSeconds
- requiredinput
- optional, can be null- Returns:
- runId
-
startWorkflow
public String startWorkflow(String workflowType, String startStateId, String workflowId, int workflowTimeoutSeconds, Object input, UnregisteredWorkflowOptions options) - Parameters:
workflowType
- requiredstartStateId
- requiredworkflowId
- requiredworkflowTimeoutSeconds
- requiredinput
- optional, can be nulloptions
- 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 theFeignException.FeignClientException
.- Type Parameters:
T
- type of the output- Parameters:
valueClass
- required, the type class of the outputworkflowId
- required, the workflowIdworkflowRunId
- optional, can be empty- Returns:
- the output result
-
getSimpleWorkflowResultWithWait
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 theFeignException.FeignClientException
.- Type Parameters:
T
- type of the output- Parameters:
valueClass
- required, the type class of the outputworkflowId
- 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 theWorkflowUncompletedException
. Else, return the same result asgetSimpleWorkflowResultWithWait(Class, String, String)
.- Type Parameters:
T
- type of the output- Parameters:
valueClass
- required, the type class of the outputworkflowId
- required, the workflowIdworkflowRunId
- optional, can be empty- Returns:
- the output result
-
tryGettingSimpleWorkflowResult
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 theWorkflowUncompletedException
. Else, return the same result asgetSimpleWorkflowResultWithWait(Class, String)
.- Type Parameters:
T
- type of the output- Parameters:
valueClass
- required, the type class of the outputworkflowId
- 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 theFeignException.FeignClientException
.- Parameters:
workflowId
- required, the workflowIdworkflowRunId
- 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
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 theFeignException.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 theWorkflowUncompletedException
. Else, return the same result asgetComplexWorkflowResultWithWait(String, String)
.- Parameters:
workflowId
- required, the workflowIdworkflowRunId
- 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
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 theWorkflowUncompletedException
. Else, return the same result asgetComplexWorkflowResultWithWait(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
-
waitForStateExecutionCompletion
-
signalWorkflow
-
resetWorkflow
public String resetWorkflow(String workflowId, String workflowRunId, ResetWorkflowTypeAndOptions resetWorkflowTypeAndOptions) - Parameters:
workflowId
- workflowIdworkflowRunId
- workflowRunIdresetWorkflowTypeAndOptions
- the combination parameter for reset- Returns:
- the new runId after reset
-
skipTimer
-
skipTimer
-
stopWorkflow
Stop a workflow, this is essentially cancel the workflow gracefully- Parameters:
workflowId
- requiredworkflowRunId
- optional
-
stopWorkflow
Stop a workflow with options- Parameters:
workflowId
- requiredworkflowRunId
- optionaloptions
- optional
-
getAnyWorkflowDataObjects
public WorkflowGetDataObjectsResponse getAnyWorkflowDataObjects(String workflowId, String workflowRunId, List<String> attributeKeys) - Parameters:
workflowId
- workflowIdworkflowRunId
- workflowRunIdattributeKeys
- , 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
- requiredworkflowRunId
- optionalneedsResults
- 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
-
searchWorkflow
-
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)
-