CBLibrary.ConsulRegister 1.0.1

Consul服务发现注册帮助组件, 具体使用方法请参阅README.md说明或者联系作者

Install-Package CBLibrary.ConsulRegister -Version 1.0.1
dotnet add package CBLibrary.ConsulRegister --version 1.0.1
<PackageReference Include="CBLibrary.ConsulRegister" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CBLibrary.ConsulRegister --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CBLibrary.ConsulRegister, 1.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install CBLibrary.ConsulRegister as a Cake Addin
#addin nuget:?package=CBLibrary.ConsulRegister&version=1.0.1

// Install CBLibrary.ConsulRegister as a Cake Tool
#tool nuget:?package=CBLibrary.ConsulRegister&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Consul服务发现注册帮助组件

CBLibrary.ConsulRegister 1.0.1

Release Notes

Features

  • Consul服务发现注册帮助

Usages

实体
public class ServiceEntity
{
    /// <summary>
    /// 健康检查地址,默认: /api/health
    /// </summary>
    public string HealthCheckUrl { get; set; } = "/api/health";

    /// <summary>
    /// 异常服务定时清理间隔,单位:秒 默认60秒
    /// </summary>
    public int CriticalServiceCleanInterval { get; set; } = 1 * 60;

    /// <summary>
    /// 健康检查间隔,单位:秒 默认5秒
    /// </summary>
    public int HealthCheckInterval { get; set; } = 5;

    /// <summary>
    /// 超时时间,单位:秒 默认10秒
    /// </summary>
    public int Timeout { get; set; } = 10;


    /// <summary>
    /// 服务名称
    /// </summary>
    public string ServiceName { get; set; }

    /// <summary>
    /// 服务IP
    /// </summary>
    public string ServiceIP { get; set; }

    /// <summary>
    /// 服务端口号
    /// </summary>
    public int ServicePort { get; set; }

    /// <summary>
    /// 服务发现IP
    /// </summary>
    public string ConsulIP { get; set; }

    /// <summary>
    /// 服务发现端口号,默认: 8500
    /// </summary>
    public int ConsulPort { get; set; } = 8500;

    /// <summary>
    /// 数据中心名称,默认: xdx
    /// </summary>
    public string DataCenter { get; set; } = "xdx";
}
注册
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime)
{
    // register this service
    app.UseConsul(lifetime, new ServiceEntity
    {
        ServiceName = "MessageService",
        ServiceIP = NetworkHelper.LocalIPAddress,
        ServicePort = 22001,
        ConsulIP = "127.0.0.1",
        ConsulPort = 8500
    });
}

Consul服务发现注册帮助组件

CBLibrary.ConsulRegister 1.0.1

Release Notes

Features

  • Consul服务发现注册帮助

Usages

实体
public class ServiceEntity
{
    /// <summary>
    /// 健康检查地址,默认: /api/health
    /// </summary>
    public string HealthCheckUrl { get; set; } = "/api/health";

    /// <summary>
    /// 异常服务定时清理间隔,单位:秒 默认60秒
    /// </summary>
    public int CriticalServiceCleanInterval { get; set; } = 1 * 60;

    /// <summary>
    /// 健康检查间隔,单位:秒 默认5秒
    /// </summary>
    public int HealthCheckInterval { get; set; } = 5;

    /// <summary>
    /// 超时时间,单位:秒 默认10秒
    /// </summary>
    public int Timeout { get; set; } = 10;


    /// <summary>
    /// 服务名称
    /// </summary>
    public string ServiceName { get; set; }

    /// <summary>
    /// 服务IP
    /// </summary>
    public string ServiceIP { get; set; }

    /// <summary>
    /// 服务端口号
    /// </summary>
    public int ServicePort { get; set; }

    /// <summary>
    /// 服务发现IP
    /// </summary>
    public string ConsulIP { get; set; }

    /// <summary>
    /// 服务发现端口号,默认: 8500
    /// </summary>
    public int ConsulPort { get; set; } = 8500;

    /// <summary>
    /// 数据中心名称,默认: xdx
    /// </summary>
    public string DataCenter { get; set; } = "xdx";
}
注册
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime)
{
    // register this service
    app.UseConsul(lifetime, new ServiceEntity
    {
        ServiceName = "MessageService",
        ServiceIP = NetworkHelper.LocalIPAddress,
        ServicePort = 22001,
        ConsulIP = "127.0.0.1",
        ConsulPort = 8500
    });
}

Release Notes

新增ServiceEntity属性

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.1 214 12/23/2019
1.0.0 485 8/7/2018