Class Client
- All Implemented Interfaces:
AutoCloseable
Construction is lazy and performs no network I/O. Every network method requires Server
protocol 4. The first network call reads the Server protocol and caches a compatible result.
An older Server causes IllegalStateException on that call and on every later call.
A Server that requires a newer protocol than this SDK supports causes the same error.
A failure to reach the Server during that check throws DexServiceException, as any
request does. The next call retries the check. The check counts against the call's request
timeout and gRPC Context deadline.
All network methods block the calling thread until the gRPC request completes. Create one
client for a registered set of Flow definitions and reuse it across calls; the underlying gRPC
channel supports concurrent callers. The supplied BlobCache is borrowed and is not closed
by the client. Service failures use typed DexServiceException subclasses. Long-poll
operations can throw LongPollTimeoutException. waitForFlow(String) returns a
FlowResult for every terminal status.
Registry registry = new Registry(Collections.<Flow<?>>singletonList(orderFlow));
try (Client client = new Client(registry, blobCache)) {
String runId = client.startFlow(orderFlow, "order-123", input);
OrderFlow rpc = client.newRpcStub(OrderFlow.class, "order-123", runId);
OrderStatus status = client.invokeRPC(rpc::getStatus);
OrderOutput output = client.waitForFlow("order-123").getSingleOutput(OrderOutput.class);
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Shuts down the client's gRPC channel.describeFlow(String flowId) Returns aFlowInfosummary of the current Flow run.getAttributes(String flowId, AttributeRead<?>... reads) Reads committed Attribute and AttributeMap instance values from the current or latest Flow run.getAttributes(String flowId, List<? extends AttributeRead<?>> reads) Reads committed values for a list of Attribute and AttributeMap instance reads.<O> OinvokeRPC(RpcDefinitions.RpcFunc0<O> rpcStubMethod) Invokes a function-style RPC without application input.<O> OinvokeRPC(RpcDefinitions.RpcFunc0<O> rpcStubMethod, RPCInvokeOptions invokeOptions) Invokes a function-style RPC without application input and adds map-instance selections.<I,O> O invokeRPC(RpcDefinitions.RpcFunc1<I, O> rpcStubMethod, I input) Invokes a function-style RPC with one input and returns its typed output.<I,O> O invokeRPC(RpcDefinitions.RpcFunc1<I, O> rpcStubMethod, I input, RPCInvokeOptions invokeOptions) Invokes a function-style RPC with one input and runtime-selected map instances.voidinvokeRPC(RpcDefinitions.RpcProc0 rpcStubMethod) Invokes a procedure-style RPC without application input.voidinvokeRPC(RpcDefinitions.RpcProc0 rpcStubMethod, RPCInvokeOptions invokeOptions) Invokes a procedure-style RPC without input and adds map-instance selections.<I> voidinvokeRPC(RpcDefinitions.RpcProc1<I> rpcStubMethod, I input) Invokes a procedure-style RPC with one input.<I> voidinvokeRPC(RpcDefinitions.RpcProc1<I> rpcStubMethod, I input, RPCInvokeOptions invokeOptions) Invokes a procedure-style RPC with one input and runtime-selected map instances.<T> StreamMessagesPage<T> listStreamMessages(String flowId, Stream<T> stream, int pageSize, String beforePageToken) Returns one newest-first page of retained Stream messages without waiting for writes.<T> TnewRpcStub(Class<T> rpcClass, String flowId) Creates a strongly typed RPC stub targeting the current run of a Flow.<T> TnewRpcStub(Class<T> rpcClass, String flowId, String runId) Creates a strongly typed RPC stub targeting a specific Flow run.<T> StreamMessage<T> readStream(String flowId, Stream<T> stream, String resumeToken) Blocks for the next retained Stream message using the server default wait.<T> StreamMessage<T> readStream(String flowId, Stream<T> stream, String resumeToken, Duration timeout) Blocks for the next retained Stream message with an explicit long-poll duration.searchFlows(String query, int pageSize) Searches Flow executions and returns the first page.searchFlows(String query, int pageSize, String nextPageToken) Searches Flow executions from a continuation token.searchFlows(String query, int pageSize, String nextPageToken, SearchFlowsOptions options) Searches with inclusion options.voidskipTimer(String flowId, StepExecutionId stepExecutionId, TimerId timerId) Makes one durable timer condition fire immediately.<I> StringStarts a registered Flow using default start options.<I> StringstartFlow(Flow<I> flow, String flowId, I input, StartFlowOptions startOptions) Starts a registered Flow with explicit start options.voidCancels a running Flow without an explicit reason.voidstopFlow(String flowId, StopFlowOptions stopOptions) Stops a running Flow with explicit terminal behavior.timeTravel(String flowId, TimeTravelOptions options) Creates a new run from a selected point in an existing Flow's history.voidtriggerContinueAsNew(String flowId) Requests that the current Flow run continue as new.voidupdateFlowConfig(String flowId, FlowConfig config) Updates the supplied mutable Flow configuration fields for the current run.<T> TwaitForAttributeMatch(String flowId, Attribute<T> attribute, AttributeMatch<T> match, WaitForAttributeOptions options) Blocks until a singleton Attribute satisfies a scalar match or its request timeout expires.<T> TwaitForAttributeMatch(String flowId, AttributeMap<T> attribute, String instance, AttributeMatch<T> match, WaitForAttributeOptions options) Blocks until an AttributeMap instance satisfies a scalar match.waitForFlow(String flowId) Blocks until a Flow reaches any terminal status.waitForFlow(String flowId, Duration timeout) Blocks for a bounded duration until a Flow reaches any terminal status.voidwaitForStepCompletion(String flowId, StepExecutionId stepExecutionId, WaitForStepCompletionOptions options) Blocks until a specific Step execution completes or its caller-visible request expires.<T> voidwriteStream(String flowId, Stream<T> stream, String source, T value) Appends one typed best-effort Stream message with producer metadata.
-
Constructor Details
-
Client
Creates a client using local development defaults.- Parameters:
registry- the nonnull registry of Flow definitions used for typed mappingblobCache- the nonnull cache used to hydrate blob-backed values- Throws:
IllegalArgumentException- if either argument isnull
-
Client
Creates a client with explicit connection, routing, and serialization options.- Parameters:
registry- the nonnull registry of Flow definitions used for typed mappingblobCache- the nonnull cache used to hydrate blob-backed valuesoptions- the nonnull client options- Throws:
IllegalArgumentException- if any argument isnull
-
-
Method Details
-
startFlow
Starts a registered Flow using default start options.- Type Parameters:
I- the Flow start input type- Parameters:
flow- the exact Flow instance registered with this clientflowId- the nonblank application-assigned Flow IDinput- the typed start-Step input, ornullfor a Flow without a start Step- Returns:
- the server-assigned run ID
- Throws:
IllegalArgumentException- if the Flow is unregistered, the ID is invalid, or the input does not match the registered start StepFlowAlreadyStartedException- if the Flow ID conflicts with an existing executionDexServiceException- if Dex otherwise rejects or cannot complete the requestIllegalStateException- if the Dex Server does not support protocol version 4
-
startFlow
Starts a registered Flow with explicit start options.- Type Parameters:
I- the Flow start input type- Parameters:
flow- the exact Flow instance registered with this clientflowId- the nonblank application-assigned Flow IDinput- the typed start-Step input, ornullfor a Flow without a start StepstartOptions- timeout, scheduling, initial state, routing, and idempotency settings- Returns:
- the server-assigned run ID
- Throws:
IllegalArgumentException- if the Flow, ID, input, or duration settings are invalid, if an initial value targets aAttribute.hardDeleteOnNull()Attribute and maps to a number or a Boolean, or if an initial Attribute's hard-delete setting differs from the definition registered for the FlowIllegalStateException- if the Dex Server does not support protocol version 4FlowAlreadyStartedException- if the Flow ID conflicts with an existing executionDexServiceException- if Dex otherwise rejects or cannot complete the request
-
newRpcStub
Creates a strongly typed RPC stub targeting the current run of a Flow.- Type Parameters:
T- the concrete Flow class- Parameters:
rpcClass- the non-final registered Flow class containingRPCmethodsflowId- the target Flow ID- Returns:
- a constructor-free stub whose RPC methods perform client requests
- Throws:
IllegalArgumentException- if the class is unregistered, final, or cannot be subclassed
-
newRpcStub
Creates a strongly typed RPC stub targeting a specific Flow run.Dex subclasses the class with ByteBuddy and allocates the stub without invoking a constructor. RPC methods and the containing class must therefore be non-final. Kotlin classes and methods are final by default and must be declared
open.- Type Parameters:
T- the concrete Flow class- Parameters:
rpcClass- the non-final registered Flow class containingRPCmethodsflowId- the target Flow IDrunId- the target run ID, or an empty string for the current run- Returns:
- a constructor-free typed RPC stub
- Throws:
IllegalArgumentException- if the class is unregistered, final, or cannot be subclassed
-
invokeRPC
Invokes a function-style RPC with one input and returns its typed output.A non-transactional RPC without Attribute locks starts from a backend query. A retained terminal execution can serve the query when the handler returns no durable effects. Locks, transactional execution, returned effects, or server policy can require an active execution.
- Type Parameters:
I- the RPC input typeO- the RPC output type- Parameters:
rpcStubMethod- a direct method reference from a stub created by this clientinput- the typed RPC input- Returns:
- the decoded RPC output
- Throws:
FlowNotActiveOrNotFoundException- if the Flow is missing or the selected path cannot use its closed executionRpcLockConflictException- if the RPC cannot acquire its Attribute locksWorkerInvocationException- if worker code fails while executing the RPCDexServiceException- if Dex otherwise rejects or cannot complete the RPCIllegalStateException- if the Dex Server does not support protocol version 4
-
invokeRPC
public <I,O> O invokeRPC(RpcDefinitions.RpcFunc1<I, O> rpcStubMethod, I input, RPCInvokeOptions invokeOptions) Invokes a function-style RPC with one input and runtime-selected map instances.- Type Parameters:
I- the RPC input typeO- the RPC output type- Parameters:
rpcStubMethod- a direct method reference from a stub created by this clientinput- the typed RPC inputinvokeOptions- additive Attribute-map locks and exact map-instance loads- Returns:
- the decoded RPC output
- Throws:
FlowDefinitionException- if an option references a definition outside the RPC FlowIllegalArgumentException- ifinvokeOptionsisnullFlowNotActiveOrNotFoundException- if the Flow is missing or the selected path cannot use its closed executionRpcLockConflictException- if the RPC cannot acquire its Attribute locksWorkerInvocationException- if worker code fails while executing the RPCDexServiceException- if Dex otherwise rejects or cannot complete the RPCIllegalStateException- if the Dex Server does not support protocol version 4
-
invokeRPC
Invokes a function-style RPC without application input.A retained terminal execution can serve a query-only RPC. Locks, transactional execution, returned effects, or server policy can require an active execution.
- Type Parameters:
O- the RPC output type- Parameters:
rpcStubMethod- a direct method reference from a stub created by this client- Returns:
- the decoded RPC output
- Throws:
FlowNotActiveOrNotFoundException- if the Flow is missing or the selected path cannot use its closed executionRpcLockConflictException- if the RPC cannot acquire its Attribute locksWorkerInvocationException- if worker code fails while executing the RPCDexServiceException- if Dex otherwise rejects or cannot complete the RPCIllegalStateException- if the Dex Server does not support protocol version 4
-
invokeRPC
Invokes a function-style RPC without application input and adds map-instance selections.- Type Parameters:
O- the RPC output type- Parameters:
rpcStubMethod- a direct method reference from a stub created by this clientinvokeOptions- additive Attribute-map locks and exact map-instance loads- Returns:
- the decoded RPC output
- Throws:
FlowDefinitionException- if an option references a definition outside the RPC FlowIllegalArgumentException- ifinvokeOptionsisnullFlowNotActiveOrNotFoundException- if the Flow is missing or the selected path cannot use its closed executionRpcLockConflictException- if the RPC cannot acquire its Attribute locksWorkerInvocationException- if worker code fails while executing the RPCDexServiceException- if Dex otherwise rejects or cannot complete the RPCIllegalStateException- if the Dex Server does not support protocol version 4
-
invokeRPC
Invokes a procedure-style RPC with one input.A retained terminal execution can serve a query-only RPC. Locks, transactional execution, returned effects, or server policy can require an active execution.
- Type Parameters:
I- the RPC input type- Parameters:
rpcStubMethod- a direct method reference from a stub created by this clientinput- the typed RPC input- Throws:
FlowNotActiveOrNotFoundException- if the Flow is missing or the selected path cannot use its closed executionRpcLockConflictException- if the RPC cannot acquire its Attribute locksWorkerInvocationException- if worker code fails while executing the RPCDexServiceException- if Dex otherwise rejects or cannot complete the RPCIllegalStateException- if the Dex Server does not support protocol version 4
-
invokeRPC
public <I> void invokeRPC(RpcDefinitions.RpcProc1<I> rpcStubMethod, I input, RPCInvokeOptions invokeOptions) Invokes a procedure-style RPC with one input and runtime-selected map instances.- Type Parameters:
I- the RPC input type- Parameters:
rpcStubMethod- a direct method reference from a stub created by this clientinput- the typed RPC inputinvokeOptions- additive Attribute-map locks and exact map-instance loads- Throws:
FlowDefinitionException- if an option references a definition outside the RPC FlowIllegalArgumentException- ifinvokeOptionsisnullFlowNotActiveOrNotFoundException- if the Flow is missing or the selected path cannot use its closed executionRpcLockConflictException- if the RPC cannot acquire its Attribute locksWorkerInvocationException- if worker code fails while executing the RPCDexServiceException- if Dex otherwise rejects or cannot complete the RPCIllegalStateException- if the Dex Server does not support protocol version 4
-
invokeRPC
Invokes a procedure-style RPC without application input.A retained terminal execution can serve a query-only RPC. Locks, transactional execution, returned effects, or server policy can require an active execution.
- Parameters:
rpcStubMethod- a direct method reference from a stub created by this client- Throws:
FlowNotActiveOrNotFoundException- if the Flow is missing or the selected path cannot use its closed executionRpcLockConflictException- if the RPC cannot acquire its Attribute locksWorkerInvocationException- if worker code fails while executing the RPCDexServiceException- if Dex otherwise rejects or cannot complete the RPCIllegalStateException- if the Dex Server does not support protocol version 4
-
invokeRPC
Invokes a procedure-style RPC without input and adds map-instance selections.- Parameters:
rpcStubMethod- a direct method reference from a stub created by this clientinvokeOptions- additive Attribute-map locks and exact map-instance loads- Throws:
FlowDefinitionException- if an option references a definition outside the RPC FlowIllegalArgumentException- ifinvokeOptionsisnullFlowNotActiveOrNotFoundException- if the Flow is missing or the selected path cannot use its closed executionRpcLockConflictException- if the RPC cannot acquire its Attribute locksWorkerInvocationException- if worker code fails while executing the RPCDexServiceException- if Dex otherwise rejects or cannot complete the RPCIllegalStateException- if the Dex Server does not support protocol version 4
-
writeStream
Appends one typed best-effort Stream message with producer metadata.Each call appends a new message. The source is informational and may be reused, including by concurrent producers. A source may contain
#.- Type Parameters:
T- the Stream message type- Parameters:
flowId- the logical Flow instance ID; the Flow need not exist or be activestream- the exact Stream registered in one Flow schemasource- the nonblank producer description returned with the messagevalue- the typed message to append- Throws:
FlowDefinitionException- if the Stream is not registeredIllegalArgumentException- if the Flow ID or source is invalidDexServiceException- if Dex cannot append the messageIllegalStateException- if the Dex Server does not support protocol version 4
-
readStream
Blocks for the next retained Stream message using the server default wait.- Type Parameters:
T- the Stream message type- Parameters:
flowId- the logical Flow instance IDstream- the exact Stream registered in one Flow schemaresumeToken- the prior token, or empty for the retained head- Returns:
- the decoded message and resumable metadata
- Throws:
IllegalStateException- if the Dex Server does not support protocol version 4
-
readStream
public <T> StreamMessage<T> readStream(String flowId, Stream<T> stream, String resumeToken, Duration timeout) Blocks for the next retained Stream message with an explicit long-poll duration.- Type Parameters:
T- the Stream message type- Parameters:
flowId- the logical Flow instance IDstream- the exact Stream registered in one Flow schemaresumeToken- the prior token, or empty for the retained headtimeout- the nonnegative whole-second server wait, ornullfor its default- Returns:
- the decoded message and resumable metadata
- Throws:
LongPollTimeoutException- if no message arrives before the wait expiresFlowDefinitionException- if the Stream is not registeredDexServiceException- if Dex cannot read the StreamIllegalStateException- if the Dex Server does not support protocol version 4
-
listStreamMessages
public <T> StreamMessagesPage<T> listStreamMessages(String flowId, Stream<T> stream, int pageSize, String beforePageToken) Returns one newest-first page of retained Stream messages without waiting for writes.An empty token starts at the retained tail. Pass the returned next-page token unchanged to read older messages. Stream trimming may remove messages between pages.
- Type Parameters:
T- the Stream message type- Parameters:
flowId- the logical Flow instance ID used as the Stream instance keystream- the exact Stream registered in one Flow schemapageSize- the positive maximum count within the server-configured limitbeforePageToken- the preceding page token, or empty for the first page- Returns:
- decoded messages in newest-first order and the next-page token
- Throws:
IllegalArgumentException- ifpageSizeis not positiveFlowDefinitionException- if the Stream is not registeredDexServiceException- if Dex cannot list the StreamIllegalStateException- if the Dex Server does not support protocol version 4
-
stopFlow
Cancels a running Flow without an explicit reason.- Parameters:
flowId- the target Flow ID- Throws:
FlowNotActiveOrNotFoundException- if the target Flow has no active executionDexServiceException- if Dex otherwise cannot stop the FlowIllegalStateException- if the Dex Server does not support protocol version 4
-
stopFlow
Stops a running Flow with explicit terminal behavior.- Parameters:
flowId- the target Flow IDstopOptions- the stop mode and optional reason- Throws:
FlowNotActiveOrNotFoundException- if the target Flow has no active executionDexServiceException- if Dex otherwise cannot stop the FlowIllegalStateException- if the Dex Server does not support protocol version 4
-
waitForFlow
Blocks until a Flow reaches any terminal status.- Parameters:
flowId- the target Flow ID- Returns:
- the terminal Flow result
- Throws:
FlowNotFoundException- if no matching Flow execution existsDexServiceException- if Dex otherwise cannot complete the wait requestIllegalStateException- if the Dex Server does not support protocol version 4
-
waitForFlow
Blocks for a bounded duration until a Flow reaches any terminal status.- Parameters:
flowId- the target Flow IDtimeout- the nonnegative whole-second long-poll duration, ornullfor no bound- Returns:
- the terminal Flow result
- Throws:
LongPollTimeoutException- iftimeoutexpires while the Flow remains runningIllegalArgumentException- iftimeoutis not a supported whole-second durationFlowNotFoundException- if no matching Flow execution existsDexServiceException- if Dex otherwise cannot complete the wait requestIllegalStateException- if the Dex Server does not support protocol version 4
-
describeFlow
Returns aFlowInfosummary of the current Flow run.The summary contains the Flow ID, run ID, Flow type, current status, and start time. It reflects the execution when Dex handles this request; a running Flow may change afterward.
- Parameters:
flowId- the target Flow ID- Returns:
- the current Flow run summary
- Throws:
FlowNotFoundException- if no matching Flow execution existsDexServiceException- if Dex otherwise cannot describe the FlowIllegalStateException- if the Dex Server does not support protocol version 4
-
getAttributes
Reads committed Attribute and AttributeMap instance values from the current or latest Flow run.Use
getAttributesto read Flow state from outside the Flow without defining an RPC. Pass one read per value: a singletonAttribute, or an AttributeMap instance selected withAttributeMap.instance(String). To read one value, pass a single read. The returnedAttributeValuesmaps each read to anOptionalof its typed value. An unset Attribute or AttributeMap instance reads asOptional.empty().The Client sends all keys in one FlowService request, so every value comes from the same committed state. No Worker runs, so the call works while no Worker is available. The read targets the current run, or the latest run when no run is open. A closed run stays readable until Dex purges it. The call sees only committed state. It does not see writes that a running Step or RPC has not committed yet. An Attribute read inside an RPC handler, by contrast, also sees that RPC's own uncommitted writes.
Hard-delete Attributes from
Attribute.hardDeleteOnNull()andAttributeMap.hardDeleteOnNull()are supported. Dex returns their current committed values, and a deleted value reads asOptional.empty(). The Client loads large values through LoadBlobs and itsBlobCache, then decodes every value with its definition's value class and the Client'sObjectMapper. The call returns only after every value decodes. On any error it throws and returns no values.Every definition must be registered by some Flow in this Client's
Registry. Registered means the exact definition object that the Flow'sFlow.getPersistenceSchema()returns. Another object with the same name is rejected, even when its value class is the same. A definition created by callinghardDeleteOnNull()again is also another object. The definition need not belong to the target Flow's type, because Dex reads each key by name. A same-named Attribute with an incompatible value class in the target Flow fails to decode.final class OrderFlow implements Flow<Void> { final Attribute<String> orderStatus = Attribute.define("order-status", String.class); final AttributeMap<Note> notes = AttributeMap.define("notes", Note.class); @Override public PersistenceSchema getPersistenceSchema() { return PersistenceSchema.of(orderStatus, notes); } } OrderFlow orderFlow = new OrderFlow(); try (Client client = new Client( new Registry(Collections.<Flow<?>>singletonList(orderFlow)), blobCache)) { AttributeValues values = client.getAttributes( "order-42", orderFlow.orderStatus, orderFlow.notes.instance("n1")); String status = values.get(orderFlow.orderStatus).orElse("new"); Optional<Note> note = values.get(orderFlow.notes.instance("n1")); } catch (FlowNotFoundException missing) { log.info("order-42 does not exist"); }- Parameters:
flowId- the non-blank Flow IDreads- at least oneAttributeorAttributeMapInstance; two reads of the same Attribute or AttributeMap instance are rejected- Returns:
- the decoded values, with one entry for every read
- Throws:
IllegalArgumentException- before any request whenflowIdis blank, no read is passed, a read isnullor is not anAttributeorAttributeMapInstance, or two reads select the same physical keyFlowDefinitionException- before any request when a definition is not registered by a Flow in the Client's Registry, or differs from the registered definition objectFlowNotFoundException- when the Flow does not exist or its latest run is being purged, including when Dex purges it between the read and the LoadBlobs requestValueMappingException- when a stored value cannot be loaded or decoded as its definition's value classIllegalStateException- when Dex returns an unexpected key, a duplicate key, or a key without a value, or if the Dex Server does not support protocol version 4DexServiceException- for other FlowService failures, including a failed LoadBlobs request; the exception keeps the gRPC code and Dex sub-status, and both its message and itsdetailstart with the call context, such asgetAttributes Flow order-42 Attributes order-status, before the Server detail
-
getAttributes
Reads committed values for a list of Attribute and AttributeMap instance reads.This overload behaves exactly like
getAttributes(String, AttributeRead...). Use it when the reads are assembled at runtime. The list is copied before the request, so later changes to it do not affect the call.List<AttributeRead<?>> reads = new ArrayList<AttributeRead<?>>(); reads.add(orderFlow.orderStatus); for (String noteId : noteIds) { reads.add(orderFlow.notes.instance(noteId)); } AttributeValues values = client.getAttributes("order-42", reads);- Parameters:
flowId- the non-blank Flow IDreads- at least oneAttributeorAttributeMapInstance; two reads of the same Attribute or AttributeMap instance are rejected- Returns:
- the decoded values, with one entry for every read
- Throws:
IllegalArgumentException- before any request whenflowIdis blank,readsisnullor empty, a read isnullor is not anAttributeorAttributeMapInstance, or two reads select the same physical keyFlowDefinitionException- before any request when a definition is not registered by a Flow in the Client's Registry, or differs from the registered definition objectFlowNotFoundException- when the Flow does not exist or its latest run is being purged, including when Dex purges it between the read and the LoadBlobs requestValueMappingException- when a stored value cannot be loaded or decoded as its definition's value classIllegalStateException- when Dex returns an unexpected key, a duplicate key, or a key without a value, or if the Dex Server does not support protocol version 4DexServiceException- for other FlowService failures, including a failed LoadBlobs request; both its message and its detail start with the call context
-
searchFlows
Searches Flow executions and returns the first page.- Parameters:
query- the server search expression, ornullfor the default searchpageSize- the nonnegative requested page size; zero uses the server default- Returns:
- the first immutable search-results page
- Throws:
IllegalArgumentException- ifpageSizeis negativeDexServiceException- if Dex cannot execute the searchIllegalStateException- if the Dex Server does not support protocol version 4
-
searchFlows
Searches Flow executions from a continuation token.- Parameters:
query- the same server search expression used for the previous pagepageSize- the nonnegative requested page size; zero uses the server defaultnextPageToken- the prior page's token, ornullfor the first page- Returns:
- an immutable search-results page
- Throws:
IllegalArgumentException- ifpageSizeis negativeDexServiceException- if Dex cannot execute the searchIllegalStateException- if the Dex Server does not support protocol version 4
-
searchFlows
public SearchFlowsPage searchFlows(String query, int pageSize, String nextPageToken, SearchFlowsOptions options) Searches with inclusion options.- Parameters:
query- filterpageSize- maximumnextPageToken- tokenoptions- inclusion- Returns:
- page
- Throws:
IllegalStateException- if the Dex Server does not support protocol version 4
-
timeTravel
Creates a new run from a selected point in an existing Flow's history.- Parameters:
flowId- the target Flow IDoptions- the time travel point and replay behavior- Returns:
- the server-assigned run ID of the new execution
- Throws:
FlowNotFoundException- if no matching Flow execution existsDexServiceException- if Dex otherwise rejects or cannot perform time travelIllegalStateException- if the Dex Server does not support protocol version 4
-
skipTimer
Makes one durable timer condition fire immediately.- Parameters:
flowId- the target Flow IDstepExecutionId- the Step execution containing the timertimerId- the timer selected by condition ID or index- Throws:
FlowNotActiveOrNotFoundException- if the target Flow has no active executionDexServiceException- if Dex otherwise cannot find or skip the timerIllegalStateException- if the Dex Server does not support protocol version 4
-
waitForStepCompletion
public void waitForStepCompletion(String flowId, StepExecutionId stepExecutionId, WaitForStepCompletionOptions options) Blocks until a specific Step execution completes or its caller-visible request expires. The server derives a stable Request ID from the Step execution when none is supplied. Request timeout covers transparent transport reattachments. Internal handler timeout controls Temporal Update generation rollover and does not end this request.- Parameters:
flowId- the target Flow IDstepExecutionId- the Step execution to observeoptions- the Request ID override and request/handler timeout controls- Throws:
IllegalArgumentException- if either timeout is unsupportedRequestTimeoutException- if a positive request timeout expires firstFlowNotActiveOrNotFoundException- if the target Flow has no active executionDexServiceException- if Dex otherwise cannot complete the wait requestIllegalStateException- if the Dex Server does not support protocol version 4
-
waitForAttributeMatch
public <T> T waitForAttributeMatch(String flowId, Attribute<T> attribute, AttributeMatch<T> match, WaitForAttributeOptions options) Blocks until a singleton Attribute satisfies a scalar match or its request timeout expires. The server derives a stable Request ID from the condition when none is supplied. Request timeout covers transparent transport reattachments. Internal handler timeout controls Temporal Update generation rollover and does not end this request.- Type Parameters:
T- the Attribute value type- Parameters:
flowId- the target Flow IDattribute- the registered Attribute definitionmatch- the scalar predicate to awaitoptions- the Request ID override and request/handler timeout controls- Returns:
- the current Attribute value that satisfied the match
- Throws:
IllegalArgumentException- if the budget, match operand, or operator is invalid, or if the definition usesAttribute.hardDeleteOnNull()orAttributeMap.hardDeleteOnNull()RequestTimeoutException- if a positive request timeout expires firstFlowNotActiveOrNotFoundException- if the target Flow has no active executionDexServiceException- if Dex otherwise cannot complete the waitIllegalStateException- if the Dex Server does not support protocol version 4
-
waitForAttributeMatch
public <T> T waitForAttributeMatch(String flowId, AttributeMap<T> attribute, String instance, AttributeMatch<T> match, WaitForAttributeOptions options) Blocks until an AttributeMap instance satisfies a scalar match.- Type Parameters:
T- the Attribute value type- Parameters:
flowId- the target Flow IDattribute- the registered Attribute-map definitioninstance- the map instancematch- the scalar predicate to awaitoptions- the Request ID override and request/handler timeout controls- Returns:
- the current AttributeMap value that satisfied the match
- Throws:
IllegalArgumentException- if the budget, match operand, or operator is invalid, or if the definition usesAttribute.hardDeleteOnNull()orAttributeMap.hardDeleteOnNull()RequestTimeoutException- if a positive request timeout expires firstFlowNotActiveOrNotFoundException- if the target Flow has no active executionDexServiceException- if Dex otherwise cannot complete the waitIllegalStateException- if the Dex Server does not support protocol version 4
-
updateFlowConfig
Updates the supplied mutable Flow configuration fields for the current run.Unset fields retain their existing values. Worker routing remains unchanged.
- Parameters:
flowId- the target Flow IDconfig- the new Flow configuration- Throws:
FlowNotActiveOrNotFoundException- if the target Flow has no active executionDexServiceException- if Dex otherwise cannot update the FlowIllegalStateException- if the Dex Server does not support protocol version 4
-
triggerContinueAsNew
Requests that the current Flow run continue as new.- Parameters:
flowId- the target Flow ID- Throws:
FlowNotActiveOrNotFoundException- if the target Flow has no active executionDexServiceException- if Dex otherwise cannot apply the requestIllegalStateException- if the Dex Server does not support protocol version 4
-
close
public void close()Shuts down the client's gRPC channel.The method waits up to five seconds for channel termination and preserves interruption status. The application owns any supplied
Credentialand the borrowedBlobCache.- Specified by:
closein interfaceAutoCloseable
-