Annotation Interface RPC
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);
}
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanRequests transactional reads and writes without requiring Attribute locks.String[]Selects exact AttributeMap instances included in the RPC snapshot.String[]Selects AttributeMaps whose current entries are included in the RPC snapshot.String[]Selects exact ChannelMap instance messages included in the RPC snapshot.String[]Selects ChannelMaps whose current pending messages are included in the RPC snapshot.String[]Selects Channels whose pending messages are included in the RPC snapshot.Selects Attribute-map instances to lock for the RPC invocation.String[]Names Attributes to lock for the RPC invocation.Overrides the RPC name.intSets the RPC execution timeout in whole seconds.
-
Element Details
-
name
String nameOverrides the RPC name.- Returns:
- the explicit name, or an empty string to use the Java method name
- Default:
""
-
timeoutSeconds
int timeoutSecondsSets the RPC execution timeout in whole seconds.- Returns:
- the timeout in seconds, or zero to use the server default
- Default:
0
-
lockAttributes
String[] lockAttributesNames Attributes to lock for the RPC invocation.- Returns:
- registered Attribute names; defaults to an empty array
- Default:
{}
-
lockAttributeMaps
RPCAttributeMapLock[] lockAttributeMapsSelects Attribute-map instances to lock for the RPC invocation.- Returns:
- map-instance lock annotations; defaults to an empty array
- Default:
{}
-
isTransactional
boolean isTransactionalRequests 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:
trueto request transactional execution; defaults tofalse
- Default:
false
-
loadAttributeMaps
String[] loadAttributeMapsSelects AttributeMaps whose current entries are included in the RPC snapshot.- Returns:
- registered AttributeMap names; defaults to an empty array
- Default:
{}
-
loadAttributeMapInstances
String[] loadAttributeMapInstancesSelects 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[] loadChannelsSelects Channels whose pending messages are included in the RPC snapshot.- Returns:
- registered singleton Channel names; defaults to an empty array
- Default:
{}
-
loadChannelMaps
String[] loadChannelMapsSelects ChannelMaps whose current pending messages are included in the RPC snapshot.- Returns:
- registered ChannelMap names; defaults to an empty array
- Default:
{}
-
loadChannelMapInstances
String[] loadChannelMapInstancesSelects 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:
{}
-