Search in sources :

Example 1 with MmqWriteRequestProcessor

use of org.monkey.mmq.core.distributed.raft.processor.MmqWriteRequestProcessor in project mmqtt by MrHKing.

the class JRaftUtils method initRpcServer.

public static RpcServer initRpcServer(JRaftServer server, PeerId peerId) {
    // GrpcRaftRpcFactory raftRpcFactory = (GrpcRaftRpcFactory) RpcFactoryHelper.rpcFactory();
    // raftRpcFactory.registerProtobufSerializer(Log.class.getName(), Log.getDefaultInstance());
    // raftRpcFactory.registerProtobufSerializer(GetRequest.class.getName(), GetRequest.getDefaultInstance());
    // raftRpcFactory.registerProtobufSerializer(WriteRequest.class.getName(), WriteRequest.getDefaultInstance());
    // raftRpcFactory.registerProtobufSerializer(ReadRequest.class.getName(), ReadRequest.getDefaultInstance());
    // raftRpcFactory.registerProtobufSerializer(Response.class.getName(), Response.getDefaultInstance());
    // 
    // MarshallerRegistry registry = raftRpcFactory.getMarshallerRegistry();
    // registry.registerResponseInstance(Log.class.getName(), Response.getDefaultInstance());
    // registry.registerResponseInstance(GetRequest.class.getName(), Response.getDefaultInstance());
    // 
    // registry.registerResponseInstance(WriteRequest.class.getName(), Response.getDefaultInstance());
    // registry.registerResponseInstance(ReadRequest.class.getName(), Response.getDefaultInstance());
    final RpcServer rpcServer = RaftRpcServerFactory.createRaftRpcServer(peerId.getEndpoint());
    // RaftRpcServerFactory.addRaftRequestProcessors(rpcServer, RaftExecutor.getRaftCoreExecutor(),
    // RaftExecutor.getRaftCliServiceExecutor());
    // Deprecated
    rpcServer.registerProcessor(new MmqLogProcessor(server, SerializeFactory.getDefault()));
    // Deprecated
    rpcServer.registerProcessor(new MmqGetRequestProcessor(server, SerializeFactory.getDefault()));
    rpcServer.registerProcessor(new MmqWriteRequestProcessor(server, SerializeFactory.getDefault()));
    rpcServer.registerProcessor(new MmqReadRequestProcessor(server, SerializeFactory.getDefault()));
    return rpcServer;
}
Also used : MmqGetRequestProcessor(org.monkey.mmq.core.distributed.raft.processor.MmqGetRequestProcessor) RpcServer(com.alipay.sofa.jraft.rpc.RpcServer) MmqLogProcessor(org.monkey.mmq.core.distributed.raft.processor.MmqLogProcessor) MmqReadRequestProcessor(org.monkey.mmq.core.distributed.raft.processor.MmqReadRequestProcessor) MmqWriteRequestProcessor(org.monkey.mmq.core.distributed.raft.processor.MmqWriteRequestProcessor)

Aggregations

RpcServer (com.alipay.sofa.jraft.rpc.RpcServer)1 MmqGetRequestProcessor (org.monkey.mmq.core.distributed.raft.processor.MmqGetRequestProcessor)1 MmqLogProcessor (org.monkey.mmq.core.distributed.raft.processor.MmqLogProcessor)1 MmqReadRequestProcessor (org.monkey.mmq.core.distributed.raft.processor.MmqReadRequestProcessor)1 MmqWriteRequestProcessor (org.monkey.mmq.core.distributed.raft.processor.MmqWriteRequestProcessor)1