Annotation Interface RPC


@Retention(RUNTIME) @Target(METHOD) public @interface RPC
Marks a public Flow method as an RPC endpoint.

An RPC method may accept Context alone or Context followed by one concrete input type. It may return void or a typed RPCResult. The registry derives the RPC name from the Java method unless name() is set. Flow classes that expose RPCs must be non-final, RPC methods must be non-final, and Kotlin users must declare both with open; the client creates a ByteBuddy stub that intercepts direct method references without running the Flow constructor.

@RPC(lockAttributes = {"balance"})
public RPCResult<Integer> addCredit(Context context, Integer amount) {
    int updated = balance.get(context) + amount;
    balance.set(context, updated);
    return RPCResult.of(updated);
}
  • Element Details

    • name

      String name
      Overrides the RPC name.
      Returns:
      the explicit name, or an empty string to use the Java method name
      Default:
      ""
    • timeoutSeconds

      int timeoutSeconds
      Sets the RPC execution timeout in whole seconds.
      Returns:
      the timeout in seconds, or zero to use the server default
      Default:
      0
    • lockAttributes

      String[] lockAttributes
      Names Attributes to lock for the RPC invocation.
      Returns:
      registered Attribute names; defaults to an empty array
      Default:
      {}
    • lockAttributeMaps

      RPCAttributeMapLock[] lockAttributeMaps
      Selects Attribute-map instances to lock for the RPC invocation.
      Returns:
      map-instance lock annotations; defaults to an empty array
      Default:
      {}
    • isTransactional

      boolean isTransactional
      Requests transactional reads and writes without requiring Attribute locks.

      Set this for an RPC that deletes a Channel message when a missing ID must prevent every other staged write from committing.

      Returns:
      true to request transactional execution; defaults to false
      Default:
      false
    • loadAttributeMaps

      String[] loadAttributeMaps
      Selects AttributeMaps whose current entries are included in the RPC snapshot.
      Returns:
      registered AttributeMap names; defaults to an empty array
      Default:
      {}
    • loadAttributeMapInstances

      String[] loadAttributeMapInstances
      Selects exact AttributeMap instances included in the RPC snapshot.

      Each value uses MapName/instance. The SDK escapes the instance portion before sending the request.

      Returns:
      registered AttributeMap instances; defaults to an empty array
      Default:
      {}
    • loadChannels

      String[] loadChannels
      Selects Channels whose pending messages are included in the RPC snapshot.
      Returns:
      registered singleton Channel names; defaults to an empty array
      Default:
      {}
    • loadChannelMaps

      String[] loadChannelMaps
      Selects ChannelMaps whose current pending messages are included in the RPC snapshot.
      Returns:
      registered ChannelMap names; defaults to an empty array
      Default:
      {}
    • loadChannelMapInstances

      String[] loadChannelMapInstances
      Selects exact ChannelMap instance messages included in the RPC snapshot.

      Each value uses MapName/instance. The SDK escapes the instance portion before sending the request.

      Returns:
      registered ChannelMap instances; defaults to an empty array
      Default:
      {}