java.lang.Object
com.inductiveautomation.ignition.gateway.rpc.RpcDelegate
All Implemented Interfaces:
RpcRouter

public class RpcDelegate extends Object implements RpcRouter
This class is a utility for creating an RpcRouter from object(s) that implement an RPC interface. Each object passed in must implement an interface annotated with RpcInterface. All methods on the annotated interface will be exposed as RPC functions.

Use RunsOnClient and RunsOnBackup annotations to allow a particular method to run in additional contexts.

Specify a client permission constant in the RpcDelegate.RunsOnClient annotation to restrict a method to certain roles. By default, RPC methods will only run when invoked from the Designer on an active or independent node.

Use the RpcDelegate.RequiredMutabilityMode annotation to indicate that a given RPC method can only be run by sessions with at least a particular mutability (aka comm) mode - as in, require read/write so that a read only session cannot run your RPC method.

Note: if the call is rejected because of one of the above restrictions, an RpcException will be thrown. If your interface doesn't declare this exception, it will be wrapped in an UndeclaredThrowableException, which you may need special handling for in your client/designer code invoking RPC.

Use CURRENT_CONTEXT to access the current RpcContext from within the method, or use the static accessors (e.g. getRequest()) to access specific elements of the context.

This class implements RpcRouter, using RpcInterface.packageId() to route by packageId, and the exposed method's name to route by function.

See Also: