---
title: "RPC"
description: "This page lists the Java SDK names for RPCs."
canonical_url: "https://docs.superdurable.io/reference/java/rpc/"
source: "docs/reference/java/rpc.mdx"
locale: "en"
---

# RPC

This page lists the Java SDK names for [RPCs](https://docs.superdurable.io/concepts/primitives/rpc.md).
The doc comment of each API gives its parameters, defaults, and errors. Read
them in the [Java SDK API reference](https://docs.superdurable.io/reference/java.md#api-reference).

<a id="api-names"></a>

## API names

| Task                                                 | Java API                                                                                                                                 | Dex behavior                                                                                                                   |
| ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Define an RPC handler                                | **@RPC** on a Flow method                                                                                                                | [Flow definition](https://docs.superdurable.io/reference/java/flow.md#flow-definition)                                         |
| Set the durable RPC name                             | **name** of **@RPC**. It defaults to the method name.                                                                                    | [Flow definition](https://docs.superdurable.io/reference/java/flow.md#flow-definition)                                         |
| Set the RPC timeout                                  | **timeoutSeconds** of **@RPC**                                                                                                           | [RPC timeout](https://docs.superdurable.io/reference/server/runtime-data.md#rpc-timeout)                                       |
| Lock Attributes for the whole call                   | **lockAttributes** and **lockAttributeMaps** of **@RPC**, with **@RPCAttributeMapLock**                                                  | [Locks](https://docs.superdurable.io/reference/server/runtime-data.md#attribute-locks)                                         |
| Request transactional reads and writes without locks | **isTransactional** of **@RPC**                                                                                                          | [Transactional RPCs](https://docs.superdurable.io/reference/server/runtime-data.md#transactional-reads-and-writes)             |
| Load AttributeMap values and Channel messages        | **loadAttributeMaps**, **loadAttributeMapInstances**, **loadChannels**, **loadChannelMaps**, and **loadChannelMapInstances** of **@RPC** | [Selective state loading](https://docs.superdurable.io/reference/server/runtime-data.md#load-collection-state)                 |
| Return the output and start next Steps               | **RPCResult.of**                                                                                                                         | [RPCs](https://docs.superdurable.io/reference/server/runtime-data.md#rpcs)                                                     |
| Cancel running Steps                                 | **RPCResult.withCancelingSteps**                                                                                                         | [Cancel running Steps](https://docs.superdurable.io/reference/server/runtime-data.md#cancel-running-steps)                     |
| Let a person invoke the RPC from Dex Web             | Not available in the Java SDK.                                                                                                           | [Actions](https://docs.superdurable.io/reference/web/dex-web.md#actions)                                                       |
| Invoke the RPC from a Client                         | **Client.invokeRPC**, on a stub from **Client.newRpcStub**                                                                               | [Invoke an RPC](https://docs.superdurable.io/reference/server/runtime-client.md#invoke-an-rpc)                                 |
| Lock or load map instances chosen at call time       | **RPCInvokeOptions**                                                                                                                     | [Runtime-selected map instances](https://docs.superdurable.io/reference/server/runtime-data.md#runtime-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.

<a id="rpc-stubs-and-kotlin"></a>

## 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**.

<a id="example"></a>

## Example

Example: [examples/java/src/main/java/io/superdurable/dex/primitives/rpc/RpcFlow.java](https://github.com/superdurable/dex/tree/main/examples/java/src/main/java/io/superdurable/dex/primitives/rpc/RpcFlow.java)
