Search in sources :

Example 11 with RpcServer

use of com.alipay.sofa.jraft.rpc.RpcServer 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)

Example 12 with RpcServer

use of com.alipay.sofa.jraft.rpc.RpcServer in project incubator-hugegraph by apache.

the class RaftSharedContext method initAndStartRpcServer.

private RpcServer initAndStartRpcServer() {
    Integer lowWaterMark = this.config().get(CoreOptions.RAFT_RPC_BUF_LOW_WATER_MARK);
    System.setProperty("bolt.channel_write_buf_low_water_mark", String.valueOf(lowWaterMark));
    Integer highWaterMark = this.config().get(CoreOptions.RAFT_RPC_BUF_HIGH_WATER_MARK);
    System.setProperty("bolt.channel_write_buf_high_water_mark", String.valueOf(highWaterMark));
    PeerId endpoint = this.endpoint();
    NodeManager.getInstance().addAddress(endpoint.getEndpoint());
    RpcServer rpcServer = RaftRpcServerFactory.createAndStartRaftRpcServer(endpoint.getEndpoint());
    return rpcServer;
}
Also used : RpcServer(com.alipay.sofa.jraft.rpc.RpcServer) PeerId(com.alipay.sofa.jraft.entity.PeerId)

Aggregations

RpcServer (com.alipay.sofa.jraft.rpc.RpcServer)12 PeerId (com.alipay.sofa.jraft.entity.PeerId)8 RaftGroupService (com.alipay.sofa.jraft.RaftGroupService)6 Configuration (com.alipay.sofa.jraft.conf.Configuration)6 NodeOptions (com.alipay.sofa.jraft.option.NodeOptions)6 File (java.io.File)6 Endpoint (com.alipay.sofa.jraft.util.Endpoint)4 IOException (java.io.IOException)3 Node (com.alipay.sofa.jraft.Node)2 GetRequest (com.alibaba.nacos.consistency.entity.GetRequest)1 Log (com.alibaba.nacos.consistency.entity.Log)1 ReadRequest (com.alibaba.nacos.consistency.entity.ReadRequest)1 Response (com.alibaba.nacos.consistency.entity.Response)1 WriteRequest (com.alibaba.nacos.consistency.entity.WriteRequest)1 NacosGetRequestProcessor (com.alibaba.nacos.core.distributed.raft.processor.NacosGetRequestProcessor)1 NacosLogProcessor (com.alibaba.nacos.core.distributed.raft.processor.NacosLogProcessor)1 NacosReadRequestProcessor (com.alibaba.nacos.core.distributed.raft.processor.NacosReadRequestProcessor)1 NacosWriteRequestProcessor (com.alibaba.nacos.core.distributed.raft.processor.NacosWriteRequestProcessor)1 KVStoreStateMachine (com.alipay.sofa.jraft.rhea.storage.KVStoreStateMachine)1 MetricsRawKVStore (com.alipay.sofa.jraft.rhea.storage.MetricsRawKVStore)1