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
965 B

using System.Collections.Generic;
using ZeroLevel.Models;
using ZeroLevel.Network;
using ZeroLevel.Services.Applications;
namespace ZeroLevel.Discovery
{
public sealed class DiscoveryService
: BaseZeroService
{
5 years ago
private IRouter _exInbox;
public DiscoveryService()
: base("Discovery")
{
}
protected override void StartAction()
{
var routeTable = new RouteTable();
Injector.Default.Register<RouteTable>(routeTable);
var socketPort = Configuration.Default.First<int>("socketport");
5 years ago
_exInbox = UseHost(socketPort);
_exInbox.RegisterInbox<IEnumerable<ServiceEndpointsInfo>>("services", (_, __) => routeTable.Get());
5 years ago
_exInbox.RegisterInbox<ZeroServiceInfo, InvokeResult>("register", (client, info) => routeTable.Append(info, client));
}
protected override void StopAction()
{
}
}
}

Powered by TurnKey Linux.