A microservice project using .NET Core 2.0, DDD, CQRS, Event Sourcing, Redis and RabbitMQ.
We will use the Nginx, Consul, Consul Template to create an service discovery and service registeration mechanism.
SelfRegister
method.Use the Log service as an example.
public void SelfRegister()
{
var serviceDiscovery = InjectContainer.GetInstance<IServiceDiscovery>();
serviceDiscovery.RegisterService(new Infrastructure.Operation.Core.Models.Service
{
Port = 5003,
ServiceName = "LogService",
Tag = "Microservice API"
});
Console.WriteLine("Register to consul successfully.");
}