public Replicator(ReplicationTarget target, ReplicationSource source)
 {
     this.target   = target;
     this.source   = source;
     this.settings = target.Endpoint.Settings;
     this.detector = Context.ActorOf(Props.Create(() => new FailureDetector(source.EndpointId, source.LogName, target.Endpoint.Settings.FailureDetectionLimit)));
 }
        public ReplicationEndpoint(
            ActorSystem system,
            string id,
            ImmutableHashSet <string> logNames,
            Func <string, Props> logFactory,
            ImmutableHashSet <ReplicationConnection> connections,
            IEndpointFilter endpointFilters       = null,
            string applicationName                = null,
            ApplicationVersion?applicationVersion = null)
        {
            System             = system;
            Id                 = id;
            LogNames           = logNames;
            LogFactory         = logFactory;
            Connections        = connections;
            EndpointFilters    = endpointFilters ?? NoFilters.Instance;
            ApplicationName    = applicationName ?? DefaultApplicationName;
            ApplicationVersion = applicationVersion ?? DefaultApplicationVersion;
            Settings           = new ReplicationSettings(system.Settings.Config);

            var logs = ImmutableDictionary.CreateBuilder <string, IActorRef>();

            foreach (var logName in logNames)
            {
                var logId = LogId(logName);
                logs[logName] = system.ActorOf(LogFactory(logId), logId);
            }
            Logs = logs.ToImmutable();

            var connectors = ImmutableHashSet.CreateBuilder <SourceConnector>();

            foreach (var connection in connections)
            {
                connectors.Add(new SourceConnector(this, connection));
            }
            this.connectors = connectors.ToImmutable();
            this.acceptor   = new Lazy <IActorRef>(() => system.ActorOf(Props.Create(() => new Acceptor(this)), Eventuate.Acceptor.Name));
            var started = this.acceptor.Value;
        }