diff --git a/TestApp/MyService.cs b/TestApp/MyService.cs index f412b5f..b4cc0ee 100644 --- a/TestApp/MyService.cs +++ b/TestApp/MyService.cs @@ -17,11 +17,12 @@ namespace TestApp protected override void StartAction() { - Log.Info("Started"); ReadServiceInfo(); - - AutoregisterInboxes(UseHost()); + var host = UseHost(8800); + AutoregisterInboxes(host); + host.OnConnect += Host_OnConnect; + host.OnDisconnect += Host_OnDisconnect; int counter = 0; Sheduller.RemindEvery(TimeSpan.FromSeconds(1), () => @@ -29,7 +30,10 @@ namespace TestApp Log.Info($"RPS: {counter}"); Interlocked.Exchange(ref counter, 0); }); - while(true) + + Exchange.RoutesStorage.Set("test.app", new IPEndPoint(IPAddress.Loopback, 8800)); + + while (true) { try { @@ -40,36 +44,16 @@ namespace TestApp Thread.Sleep(300); } } - - - + } - /* - Sheduller.RemindEvery(TimeSpan.FromSeconds(1), () => - { - var client = Exchange.GetConnection("test.app"); - client.Send("pum"); - client.Send(BaseSocket.DEFAULT_MESSAGE_INBOX, "'This is message'"); - client.Request("d2s", DateTime.Now, s => Log.Info($"Response: {s}")); - client.Request(BaseSocket.DEFAULT_REQUEST_INBOX, - new IPEndPoint(NetUtils.GetNonLoopbackAddress(), NetUtils.GetFreeTcpPort()), - s => Log.Info($"Response: {s}")); - client.Request("now", s => Log.Info($"Response date: {s}")); - client.Request(BaseSocket.DEFAULT_REQUEST_WITHOUT_ARGS_INBOX, s => Log.Info($"Response ip: {s}")); - }); - */ - /*Sheduller.RemindEvery(TimeSpan.FromSeconds(3), () => - { - Exchange.Request("test.app", "metainfo", info => - { - var si = new StringBuilder(); - si.AppendLine(info.Name); - si.AppendLine(info.ServiceKey); - si.AppendLine(info.Version); + private void Host_OnDisconnect(ISocketClient obj) + { + Log.Info($"Client '{obj.Endpoint.Address}:{obj.Endpoint.Port}' disconnected"); + } - Log.Info("Service info:\r\n{0}", si.ToString()); - }); - });*/ + private void Host_OnConnect(ExClient obj) + { + Log.Info($"Client '{obj.Socket.Endpoint.Address}:{obj.Socket.Endpoint.Port}' connected"); } [ExchangeReplierWithoutArg("counter")] diff --git a/TestApp/Program.cs b/TestApp/Program.cs index 589882e..6178ae2 100644 --- a/TestApp/Program.cs +++ b/TestApp/Program.cs @@ -9,7 +9,7 @@ namespace TestApp Bootstrap.Startup(args, () => Configuration.ReadSetFromIniFile("config.ini")) .EnableConsoleLog(ZeroLevel.Services.Logging.LogLevel.System | ZeroLevel.Services.Logging.LogLevel.FullDebug) - .UseDiscovery() + //.UseDiscovery() .Run() .WaitWhileStatus(ZeroServiceStatus.Running) .Stop(); diff --git a/ZeroLevel.SqlServer/ZeroLevel.SqlServer.csproj b/ZeroLevel.SqlServer/ZeroLevel.SqlServer.csproj index 82de616..a1a1b35 100644 --- a/ZeroLevel.SqlServer/ZeroLevel.SqlServer.csproj +++ b/ZeroLevel.SqlServer/ZeroLevel.SqlServer.csproj @@ -76,9 +76,6 @@ - - C:\Users\a.bozhenov\Desktop\SEOPortal\Utils\Semantic\packages\ZeroLevel.3.0.0\lib\netstandard2.0\ZeroLevel.dll - @@ -118,6 +115,12 @@ + + + {06c9e60e-d449-41a7-9bf0-a829aaf5d214} + ZeroLevel + +