类 ResponseMessageProcessor
- java.lang.Object
-
- network.nerve.core.rpc.netty.processor.ResponseMessageProcessor
-
public class ResponseMessageProcessor extends Object
消息处理器 Send message processor- 作者:
- tag 2019/2/25
-
-
构造器概要
构造器 构造器 说明 ResponseMessageProcessor()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static booleanhandshake(io.netty.channel.Channel channel)与已连接的模块握手 Shake hands with the core module (Manager)static booleanhandshake(String url)与已连接的模块握手 Shake hands with the core module (Manager)static StringrequestAndInvoke(String role, String cmd, Map params, String subscriptionPeriod, String subscriptionEventCounter, BaseInvoke baseInvoke)发送Request,并根据返回结果自动调用本地方法 Send the Request and automatically call the local method based on the return resultstatic StringrequestAndInvoke(String role, Request request, BaseInvoke baseInvoke)发送Request,封装Request对象(可以一次调用多个cmd) Send Request, need to wrap the Request object manually(for calling multiple methods at a time)static StringrequestAndInvokeWithAck(String role, String cmd, Map params, String subscriptionPeriod, String subscriptionEventCounter, BaseInvoke baseInvoke)发送Request,需要一个Ack作为确认,并根据返回结果自动调用本地方法 Send the Request, an Ack must be received as an acknowledgement, and automatically call the local method based on the return resultstatic ResponserequestAndResponse(String role, String cmd, Map params)发送Request,并等待Response Send Request and wait for Responsestatic ResponserequestAndResponse(String role, String cmd, Map params, long timeOut)发送Request,并等待Response Send Request and wait for Responsestatic StringrequestOnly(String role, Request request)发送Request,不接收返回 Send Request and wait for Responsestatic voidsendUnsubscribe(String messageId)取消订阅 Unsubscribestatic voidsyncKernel(String kernelUrl)static voidsyncKernel(String kernelUrl, BaseInvoke callbackInvoke)同步本地模块与核心模块(Manager) 1.
-
-
-
方法详细资料
-
handshake
public static boolean handshake(String url) throws Exception
与已连接的模块握手 Shake hands with the core module (Manager)- 返回:
- boolean
- 抛出:
Exception- 握手失败, handshake failed
-
handshake
public static boolean handshake(io.netty.channel.Channel channel) throws Exception与已连接的模块握手 Shake hands with the core module (Manager)- 返回:
- boolean
- 抛出:
Exception- 握手失败, handshake failed
-
syncKernel
public static void syncKernel(String kernelUrl, BaseInvoke callbackInvoke) throws Exception
同步本地模块与核心模块(Manager) 1. 发送本地信息给Manager 2. 获取本地所依赖的角色的连接信息Synchronize Local Module and Core Module (Manager) 1. Send local information to Manager 2. Get connection information for locally dependent roles
- 抛出:
Exception- 核心模块(Manager)不可用,Core Module (Manager) Not Available
-
requestAndResponse
public static Response requestAndResponse(String role, String cmd, Map params) throws Exception
发送Request,并等待Response Send Request and wait for Response- 参数:
role- 远程方法所属的角色,The role of remote methodcmd- 远程方法的命令,Command of the remote methodparams- 远程方法所需的参数,Parameters of the remote method- 返回:
- 远程方法的返回结果,Response of the remote method
- 抛出:
Exception- 请求超时(1分钟),timeout (1 minute)
-
requestAndResponse
public static Response requestAndResponse(String role, String cmd, Map params, long timeOut) throws Exception
发送Request,并等待Response Send Request and wait for Response- 参数:
role- 远程方法所属的角色,The role of remote methodcmd- 远程方法的命令,Command of the remote methodparams- 远程方法所需的参数,Parameters of the remote methodtimeOut- 超时时间, timeout millis- 返回:
- 远程方法的返回结果,Response of the remote method
- 抛出:
Exception- 请求超时(timeOut),timeout (timeOut)
-
requestAndInvoke
public static String requestAndInvoke(String role, String cmd, Map params, String subscriptionPeriod, String subscriptionEventCounter, BaseInvoke baseInvoke) throws Exception
发送Request,并根据返回结果自动调用本地方法 Send the Request and automatically call the local method based on the return result- 参数:
role- 远程方法所属的角色,The role of remote methodcmd- 远程方法的命令,Command of the remote methodparams- 远程方法所需的参数,Parameters of the remote methodsubscriptionPeriod- 远程方法调用频率(秒),Frequency of remote method (Second)subscriptionEventCounter- 远程方法调用频率(改变次数),Frequency of remote method (Change count)baseInvoke- 响应该结果的类的实例,Classes that respond to this result- 返回:
- messageId,用以取消订阅 / messageId, used to unsubscribe
- 抛出:
Exception- 请求超时(1分钟),timeout (1 minute)
-
requestAndInvokeWithAck
public static String requestAndInvokeWithAck(String role, String cmd, Map params, String subscriptionPeriod, String subscriptionEventCounter, BaseInvoke baseInvoke) throws Exception
发送Request,需要一个Ack作为确认,并根据返回结果自动调用本地方法 Send the Request, an Ack must be received as an acknowledgement, and automatically call the local method based on the return result- 参数:
role- 远程方法所属的角色,The role of remote methodcmd- 远程方法的命令,Command of the remote methodparams- 远程方法所需的参数,Parameters of the remote methodsubscriptionPeriod- 远程方法调用频率(秒),Frequency of remote method (Second)subscriptionEventCounter- 远程方法调用频率(改变次数),Frequency of remote method (Change count)baseInvoke- 响应该结果的类的实例,Classes that respond to this result- 返回:
- messageId,用以取消订阅 / messageId, used to unsubscribe
- 抛出:
Exception- 请求超时(1分钟),timeout (1 minute)
-
requestAndInvoke
public static String requestAndInvoke(String role, Request request, BaseInvoke baseInvoke) throws Exception
发送Request,封装Request对象(可以一次调用多个cmd) Send Request, need to wrap the Request object manually(for calling multiple methods at a time)- 参数:
role- 远程方法所属的角色,The role of remote methodrequest- 包含所有访问属性的Request对象,Request object containing all necessary informationbaseInvoke- 响应该结果的类的实例,Classes that respond to this result- 返回:
- messageId,用以取消订阅 / messageId, used to unsubscribe
- 抛出:
Exception- 请求超时(1分钟),timeout (1 minute)
-
requestOnly
public static String requestOnly(String role, Request request) throws Exception
发送Request,不接收返回 Send Request and wait for Response- 参数:
role- 远程方法所属的角色,The role of remote methodrequest- 远程方法的命令,Command of the remote method- 返回:
- 远程方法的返回结果,Response of the remote method
- 抛出:
Exception- 请求超时(1分钟),timeout (1 minute)
-
-