pull/1/head
a.bozhenov 5 years ago
parent 689c12e8dc
commit 9963ef76b6

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Concurrent;
using System.Threading; using System.Threading;
using ZeroLevel; using ZeroLevel;
using ZeroLevel.Network; using ZeroLevel.Network;
@ -9,8 +10,14 @@ namespace Processor
public class ProcessorService public class ProcessorService
: BaseZeroService : BaseZeroService
{ {
private Thread _processThread;
protected override void StartAction() protected override void StartAction()
{ {
_processThread = new Thread(HandleIncoming);
_processThread.IsBackground = true;
_processThread.Start();
ReadServiceInfo(); ReadServiceInfo();
AutoregisterInboxes(UseHost()); AutoregisterInboxes(UseHost());
@ -21,6 +28,16 @@ namespace Processor
}); });
} }
private void HandleIncoming()
{
while (_incoming.IsCompleted == false)
{
int data = _incoming.Take();
var next = (int)(data ^ Interlocked.Increment(ref _proceed));
Exchange.Request<int, bool>("test.consumer", "handle", next, result => { });
}
}
protected override void StopAction() protected override void StopAction()
{ {
} }
@ -45,11 +62,12 @@ namespace Processor
return true; return true;
} }
BlockingCollection<int> _incoming = new BlockingCollection<int>();
[ExchangeHandler("handle")] [ExchangeHandler("handle")]
public void Handler(ISocketClient client, int data) public void Handler(ISocketClient client, int data)
{ {
var next = (int)(data ^ Interlocked.Increment(ref _proceed)); _incoming.Add(data);
Exchange.Request<int, bool>("test.consumer", "handle", next, result => { });
} }
} }
} }

@ -5,17 +5,16 @@
<Description>Infrastructure layer library</Description> <Description>Infrastructure layer library</Description>
<Authors>ogoun</Authors> <Authors>ogoun</Authors>
<Company>ogoun</Company> <Company>ogoun</Company>
<AssemblyVersion>3.0.0.0</AssemblyVersion> <AssemblyVersion>3.0.0.1</AssemblyVersion>
<PackageReleaseNotes>New bootstrap concept <PackageReleaseNotes>Fixes</PackageReleaseNotes>
New network layer
No backwards compatibility with previous version</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/ogoun/Zero/wiki</PackageProjectUrl> <PackageProjectUrl>https://github.com/ogoun/Zero/wiki</PackageProjectUrl>
<Copyright>Copyright Ogoun 2019</Copyright> <Copyright>Copyright Ogoun 2019</Copyright>
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl> <PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
<PackageIconUrl>https://raw.githubusercontent.com/ogoun/Zero/master/zero.png</PackageIconUrl> <PackageIconUrl>https://raw.githubusercontent.com/ogoun/Zero/master/zero.png</PackageIconUrl>
<RepositoryUrl>https://github.com/ogoun/Zero</RepositoryUrl> <RepositoryUrl>https://github.com/ogoun/Zero</RepositoryUrl>
<RepositoryType>GitHub</RepositoryType> <RepositoryType>GitHub</RepositoryType>
<Version>3.0.0</Version> <Version>3.0.1</Version>
<FileVersion>3.0.0.1</FileVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

Loading…
Cancel
Save

Powered by TurnKey Linux.