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

rpc.turbo.common.TurboConnectService Maven / Gradle / Ivy

There is a newer version: 0.0.9
Show newest version
package rpc.turbo.common;

import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

import rpc.turbo.annotation.TurboService;

/**
 * 基本的内置服务,建立连接后需要调用
 * 
 * @author Hank
 *
 */
@TurboService(version = "1.0.0", rest = "/turbo-service")
public interface TurboConnectService {

	public static final int SERVICE_HEARTBEAT = 0;
	public static final int SERVICE_CLASS_REGISTER = 1;
	public static final int SERVICE_METHOD_REGISTER = 2;
	public static final int SERVICE_REST_REGISTER = 3;

	/**
	 * 固定死顺序,保证serviceId为预设值
	 */
	public static final Map serviceOrderMap = Map.of(//
			"heartbeat", SERVICE_HEARTBEAT, //
			"getClassRegisterList", SERVICE_CLASS_REGISTER, //
			"getMethodRegisterMap", SERVICE_METHOD_REGISTER, //
			"getRestRegisterList", SERVICE_REST_REGISTER);

	/**
	 * 心跳,true is ok
	 * 
	 * @return
	 */
	@TurboService(version = "1.0.0", rest = "/heartbeat")
	default CompletableFuture heartbeat() {
		return CompletableFuture.completedFuture(Boolean.FALSE);
	}

	/**
	 * 获取已注册的RPC类,classString
	 * 
	 * @return
	 */
	@TurboService(version = "1.0.0", rest = "/class/list")
	CompletableFuture> getClassRegisterList();

	/**
	 * 获取已注册的RPC方法,key:serviceId, value:methodString
	 * 
	 * @return
	 */
	@TurboService(version = "1.0.0", rest = "/method/list")
	CompletableFuture> getMethodRegisterMap();

	/**
	 * 获取已注册的rest服务列表
	 * 
	 * @return
	 */
	@TurboService(version = "1.0.0", rest = "/rest/list")
	CompletableFuture> getRestRegisterList();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy