跳到主要内容

RPC

查看 Markdown

This page lists the Java SDK names for RPCs. The doc comment of each API gives its parameters, defaults, and errors. Read them in the Java SDK API reference.

API names​

TaskJava APIDex behavior
Define an RPC handler@RPC on a Flow methodFlow definition
Set the durable RPC namename of @RPC. It defaults to the method name.Flow definition
Set the RPC timeouttimeoutSeconds of @RPCRPC timeout
Lock Attributes for the whole calllockAttributes and lockAttributeMaps of @RPC, with @RPCAttributeMapLockLocks
Request transactional reads and writes without locksisTransactional of @RPCTransactional RPCs
Load AttributeMap values and Channel messagesloadAttributeMaps, loadAttributeMapInstances, loadChannels, loadChannelMaps, and loadChannelMapInstances of @RPCSelective state loading
Return the output and start next StepsRPCResult.ofRPCs
Cancel running StepsRPCResult.withCancelingStepsCancel running Steps
Let a person invoke the RPC from Dex WebNot available in the Java SDK.Actions
Invoke the RPC from a ClientClient.invokeRPC, on a stub from Client.newRpcStubInvoke an RPC
Lock or load map instances chosen at call timeRPCInvokeOptionsRuntime-selected map instances

An RPC method takes a Context, optionally followed by one input. It returns void or an RPCResult. The lock and load elements of @RPC take registered names. An exact map instance uses the form MapName/instance.

RPC stubs and Kotlin​

Client.newRpcStub creates a subclass of the Flow. A Java Flow class and its RPC methods must not be final. Kotlin makes both final by default, so declare the Flow class and its RPC methods with open.

Example​

Example: examples/java/src/main/java/io/superdurable/dex/primitives/rpc/RpcFlow.java