public RegistryService(string serviceUrl, string resource) { _logger = LogEx.Trace(); _httpClient = new HttpClient(new HttpClientFactory(new HttpHandlerFactory(new List <IHttpHandler> { new HttpBearerAuthentication(new BehalfOfTokenProvider(), _logger) }, _logger), _logger), _logger); _config = new RegistryServiceConfig(serviceUrl, resource); _registryServiceHandler = new RegistryServiceClient(_httpClient, _config, _logger); }
/// <summary> /// Create registry services /// </summary> /// <param name="config"></param> /// <param name="database"></param> /// <param name="endpoints"></param> /// <param name="bulk"></param> /// <param name="broker"></param> /// <param name="logger"></param> /// <param name="metrics"></param> public ApplicationRegistry(IApplicationRepository database, IApplicationEndpointRegistry endpoints, IEndpointBulkProcessor bulk, IApplicationEventBroker broker, ILogger logger, IMetricLogger metrics, IRegistryConfig config = null) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _metrics = metrics ?? throw new ArgumentNullException(nameof(metrics)); _broker = broker ?? throw new ArgumentNullException(nameof(broker)); _database = database ?? throw new ArgumentNullException(nameof(database)); _bulk = bulk ?? throw new ArgumentNullException(nameof(bulk)); _endpoints = endpoints ?? throw new ArgumentNullException(nameof(endpoints)); _config = config; }
/// <summary> /// Create service client /// </summary> /// <param name="httpClient"></param> /// <param name="config"></param> public RegistryServiceClient(IHttpClient httpClient, IRegistryConfig config) : this(httpClient, config.OpcUaRegistryServiceUrl, config.OpcUaRegistryServiceResourceId) { }
/// <summary> /// Create service client /// </summary> /// <param name="httpClient"></param> /// <param name="config"></param> /// <param name="logger"></param> public RegistryServiceClient(IHttpClient httpClient, IRegistryConfig config, ILogger logger) : this(httpClient, config.OpcUaRegistryServiceUrl, config.OpcUaRegistryServiceResourceId, logger) { }
/// <summary> /// Create service client /// </summary> /// <param name="httpClient"></param> /// <param name="config"></param> /// <param name="serializer"></param> public RegistryServiceClient(IHttpClient httpClient, IRegistryConfig config, ISerializer serializer) : this(httpClient, config?.OpcUaRegistryServiceUrl, serializer) { }