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

52 lines
1.4 KiB

using System.Collections.Generic;
using ZeroLevel.Models;
using ZeroLevel.Network;
using ZeroLevel.Services.Applications;
6 years ago
using ZeroLevel.Services.Serialization;
6 years ago
namespace ZeroLevel.Discovery
{
public sealed class DiscoveryService
: BaseWindowsService, IZeroService
{
private IExService _exInbox;
public DiscoveryService()
6 years ago
: base("Discovery")
{
}
public override void DisposeResources()
{
}
6 years ago
public override void PauseAction()
{
}
public override void ResumeAction()
{
}
public override void StartAction()
{
var routeTable = new RouteTable();
Injector.Default.Register<RouteTable>(routeTable);
var port = Configuration.Default.First<int>("apiport");
6 years ago
Startup.StartWebPanel(port, false);
var socketPort = Configuration.Default.First<int>("socketport");
6 years ago
_exInbox = ExchangeTransportFactory.GetServer(socketPort);
_exInbox.RegisterInbox<IEnumerable<ServiceEndpointsInfo>>("services", (_, __) => routeTable.Get());
_exInbox.RegisterInbox<ExServiceInfo, InvokeResult>("register", (info, _, __) => routeTable.Append(info));
6 years ago
Log.Info($"TCP server started {_exInbox.Endpoint.Address}:{socketPort}");
6 years ago
}
public override void StopAction()
{
_exInbox.Dispose();
6 years ago
}
}
}

Powered by TurnKey Linux.