You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/ZeroLevel.Discovery/DiscoveryService.cs

32 lines
918 B

using System.Linq;
using ZeroLevel.Models;
using ZeroLevel.Network;
using ZeroLevel.Services.Applications;
namespace ZeroLevel.Discovery
{
public sealed class DiscoveryService
: BaseZeroService
{
5 years ago
private IRouter _exInbox;
private ServiceEndpointsTable _table;
public DiscoveryService()
: base("Discovery")
{
}
protected override void StartAction()
{
_table = new ServiceEndpointsTable();
5 years ago
var servicePort = Configuration.Default.First<int>("port");
_exInbox = UseHost(servicePort);
_exInbox.RegisterInbox("services", (_) => _table.GetRoutingTable().ToList());
_exInbox.RegisterInbox<ServiceRegisterInfo, InvokeResult>("register", (client, info) => _table.AppendOrUpdate(info, client));
}
protected override void StopAction()
{
}
}
}

Powered by TurnKey Linux.