ServiceGovernance / ServiceGovernance.Registry.Agent

Library providing an agent for the Service Registry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ServiceGovernance.Registry.Agent

Build status NuGet Version License

Provides an Agent (client) for the ServiceRegistry. This agent registers the ASP.NET Core Service (your API web service) in the ServiceRegistry on application startup and unregisters it on application shutdown.

Usage

Install the NuGet package ServiceGovernance.Registry.Agent.

public void ConfigureServices(IServiceCollection services)
{
    ...
    services.AddServiceRegistryAgent(options => {
            options.Registry = new Uri("https://myserviceregistry.mycompany.com");
            options.ServiceIdentifier = "Api1";
            options.ServiceDisplayName = "My Api";
            options.PublicUrls = new[]{new Uri("https://api1.mycompany.com")}
            });
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    ...
    app.UseMvc();
    ...
    app.UseServiceRegistryAgent();
}

Configuration

It's also possible to provide these options via the configuration:

public void ConfigureServices(IServiceCollection services)
{
    ...
    services.AddServiceRegistryAgent(options => Configuration.Bind("ServiceRegistry", options));
}
{
    "ServiceRegistry": {
        "Registry": "https://myserviceregistry.mycompany.com",
        "ServiceIdentifier": "Api1",
        "ServiceDisplayName": "My Api",
        "PublicUrls": ["https://api1.mycompany.com"]
    }
}

Service urls

The url, the service is available on and which will be registered in the ServiceRegistry, will be detected automatically. You can manually provide the service urls via the ServiceEndpoints property (or configuration key).

About

Library providing an agent for the Service Registry

License:Apache License 2.0


Languages

Language:C# 68.6%Language:PowerShell 22.4%Language:Shell 9.0%