Description
It needs to design convinient public API for networking module which allow to get information about network members and send/receive messages from them.
Draft:
public interface NetworkService { static NetworkService create(NetworkConfiguration cfg); void shutdown() throws ???; NetworkMember localMember(); Collection<NetworkMember> remoteMembers(); void weakSend(NetworkMember member, Message msg); Future<?> guaranteedSend(NetworkMember member, Message msg); void listenMembers(MembershipListener lsnr); void listenMessages(Consumer<MessagingEvent> lsnr); } public interface MembershipListener { void onAppeared(NetworkMember member); void onDisappeared(NetworkMember member); void onAcceptedByGroup(List<NetworkMember> remoteMembers); } public interface NetworkMember { UUID id(); }