Search in sources :

Example 1 with GrpcFactory

use of org.apache.ratis.grpc.GrpcFactory in project incubator-ratis by apache.

the class Client method run.

@Override
public void run() throws Exception {
    RaftProperties raftProperties = new RaftProperties();
    RaftGroup raftGroup = new RaftGroup(RaftGroupId.valueOf(ByteString.copyFromUtf8(raftGroupId)), parsePeers(peers));
    RaftClient.Builder builder = RaftClient.newBuilder().setProperties(raftProperties);
    builder.setRaftGroup(raftGroup);
    builder.setClientRpc(new GrpcFactory(new Parameters()).newRaftClientRpc(ClientId.randomId(), raftProperties));
    RaftClient client = builder.build();
    operation(client);
}
Also used : Parameters(org.apache.ratis.conf.Parameters) GrpcFactory(org.apache.ratis.grpc.GrpcFactory) RaftProperties(org.apache.ratis.conf.RaftProperties) RaftGroup(org.apache.ratis.protocol.RaftGroup) RaftClient(org.apache.ratis.client.RaftClient)

Aggregations

RaftClient (org.apache.ratis.client.RaftClient)1 Parameters (org.apache.ratis.conf.Parameters)1 RaftProperties (org.apache.ratis.conf.RaftProperties)1 GrpcFactory (org.apache.ratis.grpc.GrpcFactory)1 RaftGroup (org.apache.ratis.protocol.RaftGroup)1