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

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

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

Loading…
Cancel
Save

Powered by TurnKey Linux.