Class RPCResult<O>
- Type Parameters:
O- the concrete Java RPC output type
Return this value from a function-style RPC method. The output is encoded according to
the RPC method's declared generic return type, while movements let an RPC start or advance Flow
execution atomically with its state changes.
@RPC
public RPCResult<OrderStatus> approve(Context context, Approval input) {
return RPCResult.of(OrderStatus.APPROVED, StepMovement.of(ShipOrder.class, input.order))
.withCancelingSteps(QuoteCarrier.class, ApprovalTimeout.class);
}
-
Method Summary
Modifier and TypeMethodDescriptionstatic <O> RPCResult<O> of(O output) Creates an RPC result without next Steps.static <O> RPCResult<O> of(O output, StepMovement<?>... nextSteps) Creates an RPC result that also schedules next Steps.withCancelingSteps(Class<? extends Step<?>>... stepClasses) Cancels queued or active executions of the selected Step types in the current Flow.
-
Method Details
-
of
Creates an RPC result without next Steps.- Type Parameters:
O- the output type- Parameters:
output- the typed RPC output, which may benull- Returns:
- the RPC result
-
of
Creates an RPC result that also schedules next Steps.- Type Parameters:
O- the output type- Parameters:
output- the typed RPC output, which may benullnextSteps- the movements to schedule- Returns:
- the RPC result
-
withCancelingSteps
Cancels queued or active executions of the selected Step types in the current Flow.Dex resolves the selection after this RPC's Attribute and Channel writes commit and before this result's next-Step movements are enqueued. Existing executions that already finished, were canceled, or do not exist are ignored. Dex interrupts a selected Java handler when cancellation reaches its Worker and continues with this result's next Steps without waiting for that handler to return.
Repeated calls take the union of their arguments. Each argument must be a Step class registered with the current Flow; a
nullor external Step class causes an invalid RPC result. RPC results cannot select sibling executions because separate invocations do not share an invocation-scoped Step execution lineage.- Parameters:
stepClasses- registered Step classes whose queued or active executions should be canceled- Returns:
- a new RPC result containing the combined cancellation selection
-