Package io.hekate.rpc

Annotation Type RpcAffinityKey


  • @Documented
    @Target(PARAMETER)
    @Retention(RUNTIME)
    public @interface RpcAffinityKey
    Affinity key for RPC operations.

    This annotation can be placed on a parameter of an @Rpc-enabled interface's method. For each invocation of such RPC method, value of that parameter will be used as affinity key for RPC request routing.

    Specifying the affinity key ensures that all RPC requests submitted with the same key will always be transmitted over the same network connection and will always be processed by the same thread.

    RpcLoadBalancer can also make use of the affinity key to perform consistent routing of messages among the cluster node. For example, the default load balancer makes sure that all messages, having the same key, are always routed to the same node (unless topology doesn't change).