public static IServiceCatalog Create([NotNull] IDiscoveryTransport transport)
        {
            if (transport == null)
            {
                throw new ArgumentNullException(nameof(transport));
            }

            var catalog = new ServiceCatalog();
            var consul  = new Consul(catalog, transport);

            return(catalog);
        }
Ejemplo n.º 2
0
        public Consul([NotNull] ServiceCatalog catalog, [NotNull] IDiscoveryTransport transport)
        {
            if (catalog == null)
            {
                throw new ArgumentNullException(nameof(catalog));
            }
            if (transport == null)
            {
                throw new ArgumentNullException(nameof(transport));
            }

            _catalog   = catalog;
            _transport = transport;

            catalog.ServiceRegistered   += OnServiceRegistered;
            transport.ServicesRequested += OnServicesRequested;
            transport.ServiceDiscovered += OnServiceDiscovered;

            DiscoverWorld();
        }