Class PekkoRpcService

    • Method Detail

      • getActorSystem

        public org.apache.pekko.actor.ActorSystem getActorSystem()
      • getVersion

        protected int getVersion()
      • getAddress

        public String getAddress()
        Description copied from interface: RpcService
        Return the hostname or host address under which the rpc service can be reached. If the rpc service cannot be contacted remotely, then it will return an empty string.
        Specified by:
        getAddress in interface RpcService
        Returns:
        Address of the rpc service or empty string if local rpc service
      • getPort

        public int getPort()
        Description copied from interface: RpcService
        Return the port under which the rpc service is reachable. If the rpc service cannot be contacted remotely, then it will return -1.
        Specified by:
        getPort in interface RpcService
        Returns:
        Port of the rpc service or -1 if local rpc service
      • getSelfGateway

        public <C extends RpcGateway> C getSelfGateway​(Class<C> selfGatewayType,
                                                       RpcServer rpcServer)
        Description copied from interface: RpcService
        Returns a self gateway of the specified type which can be used to issue asynchronous calls against the RpcEndpoint.

        IMPORTANT: The self gateway type must be implemented by the RpcEndpoint. Otherwise the method will fail.

        Specified by:
        getSelfGateway in interface RpcService
        Type Parameters:
        C - type of the self gateway to create
        Parameters:
        selfGatewayType - class of the self gateway type
        Returns:
        Self gateway of the specified type which can be used to issue asynchronous rpcs
      • connect

        public <C extends RpcGatewayCompletableFuture<C> connect​(String address,
                                                                   Class<C> clazz)
        Description copied from interface: RpcService
        Connect to a remote rpc server under the provided address. Returns a rpc gateway which can be used to communicate with the rpc server. If the connection failed, then the returned future is failed with a RpcConnectionException.
        Specified by:
        connect in interface RpcService
        Type Parameters:
        C - Type of the rpc gateway to return
        Parameters:
        address - Address of the remote rpc server
        clazz - Class of the rpc gateway to return
        Returns:
        Future containing the rpc gateway or an RpcConnectionException if the connection attempt failed
      • connect

        public <F extends Serializable,​C extends FencedRpcGateway<F>> CompletableFuture<C> connect​(String address,
                                                                                                         F fencingToken,
                                                                                                         Class<C> clazz)
        Description copied from interface: RpcService
        Connect to a remote fenced rpc server under the provided address. Returns a fenced rpc gateway which can be used to communicate with the rpc server. If the connection failed, then the returned future is failed with a RpcConnectionException.
        Specified by:
        connect in interface RpcService
        Type Parameters:
        F - Type of the fencing token
        C - Type of the rpc gateway to return
        Parameters:
        address - Address of the remote rpc server
        fencingToken - Fencing token to be used when communicating with the server
        clazz - Class of the rpc gateway to return
        Returns:
        Future containing the fenced rpc gateway or an RpcConnectionException if the connection attempt failed
      • startServer

        public <C extends RpcEndpoint & RpcGatewayRpcServer startServer​(C rpcEndpoint,
                                                                          Map<String,​String> loggingContext)
        Description copied from interface: RpcService
        Start a rpc server which forwards the remote procedure calls to the provided rpc endpoint.
        Specified by:
        startServer in interface RpcService
        Type Parameters:
        C - Type of the rpc endpoint
        Parameters:
        rpcEndpoint - Rpc protocol to dispatch the rpcs to
        Returns:
        Self gateway to dispatch remote procedure calls to oneself
      • stopServer

        public void stopServer​(RpcServer selfGateway)
        Description copied from interface: RpcService
        Stop the underlying rpc server of the provided self gateway.
        Specified by:
        stopServer in interface RpcService
        Parameters:
        selfGateway - Self gateway describing the underlying rpc server
      • getScheduledExecutor

        public ScheduledExecutor getScheduledExecutor()
        Description copied from interface: RpcService
        Gets a scheduled executor from the RPC service. This executor can be used to schedule tasks to be executed in the future.

        IMPORTANT: This executor does not isolate the method invocations against any concurrent invocations and is therefore not suitable to run completion methods of futures that modify state of an RpcEndpoint. For such operations, one needs to use the MainThreadExecutionContext of that RpcEndpoint.

        Specified by:
        getScheduledExecutor in interface RpcService
        Returns:
        The RPC service provided scheduled executor