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;
}
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;
}
Aggregations