use of io.atomix.protocols.raft.protocol.RaftClientMessagingProtocol in project atomix by atomix.
the class RaftPerformanceTest method createClient.
/**
* Creates a Raft client.
*/
private RaftClient createClient() throws Exception {
Node node = nextNode(Node.Type.CLIENT);
RaftClientProtocol protocol;
if (USE_NETTY) {
MessagingService messagingService = NettyMessagingService.builder().withEndpoint(node.endpoint()).build().start().join();
protocol = new RaftClientMessagingProtocol(messagingService, protocolSerializer, endpointMap::get);
} else {
protocol = protocolFactory.newClientProtocol(node.id());
}
RaftClient client = RaftClient.builder().withNodeId(node.id()).withProtocol(protocol).withThreadModel(ThreadModel.THREAD_PER_SERVICE).build();
client.connect(members.stream().map(Node::id).collect(Collectors.toList())).join();
clients.add(client);
return client;
}
use of io.atomix.protocols.raft.protocol.RaftClientMessagingProtocol in project atomix by atomix.
the class RaftFuzzTest method createClient.
/**
* Creates a Raft client.
*/
private RaftClient createClient() throws Exception {
NodeId nodeId = nextNodeId();
RaftClientProtocol protocol;
if (USE_NETTY) {
Endpoint endpoint = new Endpoint(InetAddress.getLocalHost(), ++port);
MessagingService messagingManager = NettyMessagingService.builder().withEndpoint(endpoint).build().start().join();
endpointMap.put(nodeId, endpoint);
protocol = new RaftClientMessagingProtocol(messagingManager, protocolSerializer, endpointMap::get);
} else {
protocol = protocolFactory.newClientProtocol(nodeId);
}
RaftClient client = RaftClient.builder().withNodeId(nodeId).withProtocol(protocol).build();
client.connect(members.stream().map(RaftMember::nodeId).collect(Collectors.toList())).join();
clients.add(client);
return client;
}
Aggregations