类 RequestMessageProcessor


  • public class RequestMessageProcessor
    extends Object
    消息处理器 Receive message processor
    作者:
    tag 2019/2/25
    • 构造器详细资料

      • RequestMessageProcessor

        public RequestMessageProcessor()
    • 方法详细资料

      • negotiateConnectionResponse

        public static void negotiateConnectionResponse​(io.netty.channel.Channel channel,
                                                       Message message)
                                                throws com.fasterxml.jackson.core.JsonProcessingException
        确认握手成功 Confirm successful handshake
        参数:
        channel - 用于发送消息 / Used to send message
        抛出:
        com.fasterxml.jackson.core.JsonProcessingException - JSON解析错误 / JSON parsing error
      • ack

        public static void ack​(io.netty.channel.Channel channel,
                               String messageId)
                        throws com.fasterxml.jackson.core.JsonProcessingException
        确认收到Request Confirm receipt of Request
        参数:
        channel - 用于发送消息 / Used to send message
        messageId - 原始消息ID / The origin message ID
        抛出:
        com.fasterxml.jackson.core.JsonProcessingException - JSON解析错误 / JSON parsing error
      • serviceNotStarted

        public static void serviceNotStarted​(io.netty.channel.Channel channel,
                                             String messageId)
                                      throws com.fasterxml.jackson.core.JsonProcessingException
        服务还未启动完成 The service has not been started yet.
        参数:
        channel - 链接通道
        messageId - 请求ID
        抛出:
        com.fasterxml.jackson.core.JsonProcessingException
      • unsubscribe

        public static void unsubscribe​(ConnectData channelData,
                                       Message message)
        取消订阅 For Unsubscribe
        参数:
        message - 取消订阅的消息体 / Unsubscribe message
      • responseWithPeriod

        public static boolean responseWithPeriod​(ConnectData channelData,
                                                 Message message,
                                                 Request request)
        处理Request,返回bool类型表示处理完之后是保留还是丢弃 After current processing, do need to keep the Request information and wait for the next processing? True: keep, False: remove
        参数:
        channelData - 用于发送消息 / Used to send message
        message - 原始消息 / The origin message
        request - 请求 / The request
        返回:
        boolean
      • callCommandsWithPeriod

        public static void callCommandsWithPeriod​(io.netty.channel.Channel channel,
                                                  Map requestMethods,
                                                  String messageId,
                                                  boolean isSubscribe)
                                           throws com.fasterxml.jackson.core.JsonProcessingException
        处理Request,自动调用正确的方法,返回结果 Processing Request, automatically calling the correct method, returning the result
        参数:
        channel - 用于发送消息 / Used to send message
        requestMethods - 请求的方法集合 / The collections of request method
        messageId - 原始消息ID / The origin message ID
        isSubscribe - is subscribe message
        抛出:
        com.fasterxml.jackson.core.JsonProcessingException - 服务器端处理异常
      • callCommands

        public static void callCommands​(Map requestMethods)
                                 throws com.fasterxml.jackson.core.JsonProcessingException
        处理Request,不返回结果 Processing Request, automatically calling the correct method, returning the result
        参数:
        requestMethods - 请求的方法集合 / The collections of request method
        抛出:
        com.fasterxml.jackson.core.JsonProcessingException - 服务器端处理异常
      • responseWithEventCount

        public static void responseWithEventCount​(io.netty.channel.Channel channel,
                                                  Response realResponse)
        处理Request,如果达到EventCount的发送条件,则发送 Processing Request, if EventCount's sending condition is met, then send
        参数:
        channel - 用于发送消息 / Used to send message
        realResponse - 订阅事件触发,返回数据