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/TestPipeLine/Consumer/ConsumerService.cs

55 lines
1.3 KiB

5 years ago
using System;
using System.Threading;
5 years ago
using ZeroLevel;
using ZeroLevel.Network;
using ZeroLevel.Services.Applications;
namespace Consumer
{
public class ConsumerService
: BaseZeroService
{
protected override void StartAction()
{
ReadServiceInfo();
AutoregisterInboxes(UseHost());
5 years ago
Sheduller.RemindEvery(TimeSpan.FromSeconds(1), () =>
{
Console.SetCursorPosition(0, 0);
Console.WriteLine(_proceed);
});
5 years ago
}
protected override void StopAction()
{
}
[ExchangeReplierWithoutArg("meta")]
public ZeroServiceInfo GetCounter(ISocketClient client)
{
return ServiceInfo;
}
private long _proceed = 0;
[ExchangeReplierWithoutArg("Proceed")]
public long GetProceedItemsCount(ISocketClient client)
{
return _proceed;
}
[ExchangeReplierWithoutArg("ping")]
public bool Ping(ISocketClient client)
{
return true;
}
[ExchangeReplier("handle")]
public bool Handler(ISocketClient client, int data)
{
return (data ^ Interlocked.Increment(ref _proceed)) % 2 == 0;
}
}
}

Powered by TurnKey Linux.