Search in sources :

Example 1 with ApiRequestHandler

use of com.akaxin.site.connector.handler.ApiRequestHandler in project openzaly by akaxincom.

the class Bootstrap method startNettyServer.

/**
 * 启动Netty服务器,提供用户与站点服务之间的长链接功能
 *
 * @param address
 * @param port
 * @throws Exception
 */
private static void startNettyServer(String address, int port) throws Exception {
    new NettyServer() {

        @Override
        public void loadExecutor(AbstracteExecutor<Command, CommandResponse> executor) {
            executor.addChain(RequestAction.IM_SITE.getName(), new ImSiteAuthHandler());
            executor.addChain(RequestAction.IM.getName(), new ImMessageHandler());
            executor.addChain(RequestAction.API.getName(), new ApiRequestHandler());
        }
    }.start(address, port);
    logger.info("{} start netty server {}:{} ok.", AkxProject.PLN, address, port);
}
Also used : Command(com.akaxin.common.command.Command) ApiRequestHandler(com.akaxin.site.connector.handler.ApiRequestHandler) ImSiteAuthHandler(com.akaxin.site.connector.handler.ImSiteAuthHandler) CommandResponse(com.akaxin.common.command.CommandResponse) ImMessageHandler(com.akaxin.site.connector.handler.ImMessageHandler) NettyServer(com.akaxin.site.connector.netty.NettyServer)

Aggregations

Command (com.akaxin.common.command.Command)1 CommandResponse (com.akaxin.common.command.CommandResponse)1 ApiRequestHandler (com.akaxin.site.connector.handler.ApiRequestHandler)1 ImMessageHandler (com.akaxin.site.connector.handler.ImMessageHandler)1 ImSiteAuthHandler (com.akaxin.site.connector.handler.ImSiteAuthHandler)1 NettyServer (com.akaxin.site.connector.netty.NettyServer)1