use of io.atomix.protocols.raft.test.protocol.RaftClientMessagingProtocol in project atomix by atomix.
the class RaftPerformanceTest method createClient.
/**
* Creates a Raft client.
*/
private RaftClient createClient() throws Exception {
Member member = nextNode();
RaftClientProtocol protocol;
if (USE_NETTY) {
MessagingService messagingService = new NettyMessagingService("test", member.address(), new MessagingConfig()).start().join();
protocol = new RaftClientMessagingProtocol(messagingService, PROTOCOL_SERIALIZER, addressMap::get);
} else {
protocol = protocolFactory.newClientProtocol(member.id());
}
RaftClient client = RaftClient.builder().withMemberId(member.id()).withPartitionId(PartitionId.from("test", 1)).withProtocol(protocol).withThreadModel(ThreadModel.SHARED_THREAD_POOL).build();
client.connect(members.stream().map(Member::id).collect(Collectors.toList())).join();
clients.add(client);
return client;
}
use of io.atomix.protocols.raft.test.protocol.RaftClientMessagingProtocol in project atomix by atomix.
the class RaftFuzzTest method createClient.
/**
* Creates a Raft client.
*/
private RaftClient createClient() throws Exception {
MemberId memberId = nextNodeId();
RaftClientProtocol protocol;
if (USE_NETTY) {
Address address = Address.from(++port);
MessagingService messagingManager = new NettyMessagingService("test", address, new MessagingConfig()).start().join();
addressMap.put(memberId, address);
protocol = new RaftClientMessagingProtocol(messagingManager, PROTOCOL_SERIALIZER, addressMap::get);
} else {
protocol = protocolFactory.newClientProtocol(memberId);
}
RaftClient client = RaftClient.builder().withMemberId(memberId).withProtocol(protocol).build();
client.connect(members.stream().map(RaftMember::memberId).collect(Collectors.toList())).join();
clients.add(client);
return client;
}
Aggregations