All Downloads are FREE. Search and download functionalities are using the official Maven repository.

colesico.framework.rpc.teleapi.RpcExchange Maven / Gradle / Ivy

The newest version!
package colesico.framework.rpc.teleapi;

import colesico.framework.rpc.RpcError;

import java.lang.reflect.Type;

/**
 * Facade for interaction within given transport
 */
public interface RpcExchange {

    /**
     * Returns operation from request
     */
    Operation resolveOperation();

     Q readRequest(Type requestType);

     void writeResponse(R response);

    /**
     * Send common error.
     * On client side this error must be represented as an {@link colesico.framework.rpc.RpcException}
     */
    void sendError(RpcError error);

    /**
     * Rpc namespce, api and method name to be invoked
     */
    record Operation(String rpcNamespace, String rpcApiName, String rpcMethodName) {

        @Override
        public String toString() {
            return "Operation{" +
                    "rpcNamespace='" + rpcNamespace + '\'' +
                    ", rpcApiName='" + rpcApiName + '\'' +
                    ", rpcMethodName='" + rpcMethodName + '\'' +
                    '}';
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy