Beispiel #1
0
        private void OnNSQMessageRecieved(NSQMessageEventArgs e)
        {
            System.Threading.Interlocked.Decrement(ref _readyCount);

            if (_readyCount == 0)
            {
                //signal failure??
                return;
            }

            System.Threading.Interlocked.Increment(ref _processingCount);

            if (NSQMessageRecieved != null)
            {
                NSQMessageRecieved(this, e);
            }

            System.Threading.Interlocked.Decrement(ref _processingCount);
            System.Threading.Interlocked.Increment(ref _readyCount);
            try
            {
                UpdateReadyCount();
            }
            catch (ArgumentException)
            {
                this.Stop();
            }
        }
Beispiel #2
0
        private void OnNSQMessageRecieved(NSQMessageEventArgs e)
        {
            if (_readyCount <= 0)
            {
                return;
            }

            if (System.Threading.Interlocked.Decrement(ref _readyCount) < 0)
            {
                System.Threading.Volatile.Write(ref _readyCount, 0);
                return;
            }

            System.Threading.Interlocked.Increment(ref _processingCount);

            var handler = this.NSQMessageRecieved;

            if (handler != null)
            {
                handler(this, e);
            }

            System.Threading.Interlocked.Decrement(ref _processingCount);
            System.Threading.Interlocked.Increment(ref _readyCount);

            UpdateReadyCount();
        }
Beispiel #3
0
        public void OnNSQMessageRecieved(NSQMessageEventArgs e)
        {
            var handler = this.NSQMessageReceived;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Beispiel #4
0
        private Task SignalMessageRecievedEventAsync(NSQMessageEventArgs e)
        {
            NSQProtocol _protocol = this;

            return(TaskEx.Run(() =>
            {
                var handler = this.NSQMessageReceived;
                if (handler != null)
                {
                    handler(_protocol, e);
                }
            }));
        }
Beispiel #5
0
 private Task SignalMessageRecievedEventAsync(NSQMessageEventArgs e)
 {
     NSQProtocol _protocol = this;
     return Task.Run(() =>
     {
         if (NSQMessageRecieved != null)
             NSQMessageRecieved(_protocol, e);
     });
 }
Beispiel #6
0
 private async void SignalMessageRecievedEvent(NSQMessageEventArgs e)
 {
     await SignalMessageRecievedEventAsync(e);
 }
Beispiel #7
0
 public void OnNSQMessageRecieved(NSQMessageEventArgs e)
 {
     if (NSQMessageRecieved != null)
         NSQMessageRecieved(this, e);
 }
Beispiel #8
0
 private Task SignalMessageRecievedEventAsync(NSQMessageEventArgs e)
 {
     NSQProtocol _protocol = this;
     return Task.Run(() =>
     {
         var handler = this.NSQMessageReceived;
         if (handler != null)
             handler(_protocol, e);
     });
 }
Beispiel #9
0
 public void OnNSQMessageRecieved(NSQMessageEventArgs e)
 {
     var handler = this.NSQMessageReceived;
     if (handler != null)
     {
         handler(this, e);
     }
 }
Beispiel #10
0
 private void NSQProtocolMessageRecieved(object sender, NSQMessageEventArgs e)
 {
     this.OnNSQMessageRecieved(e);
 }
Beispiel #11
0
        private void OnNSQMessageRecieved(NSQMessageEventArgs e)
        {
            System.Threading.Interlocked.Decrement(ref _readyCount);

            if (_readyCount == 0)
            {
                return;
            }

            System.Threading.Interlocked.Increment(ref _processingCount);

            var handler = this.NSQMessageRecieved;
            if (handler != null)
                handler(this, e);

            System.Threading.Interlocked.Decrement(ref _processingCount);
            System.Threading.Interlocked.Increment(ref _readyCount);
            UpdateReadyCount();
        }
Beispiel #12
0
 private void NSQProtocolMessageRecieved(object sender, NSQMessageEventArgs e)
 {
     this.OnNSQMessageRecieved(e);
 }
Beispiel #13
0
 private async void SignalMessageRecievedEvent(NSQMessageEventArgs e)
 {
     await SignalMessageRecievedEventAsync(e);
 }
Beispiel #14
0
        private void OnNSQMessageRecieved(NSQMessageEventArgs e)
        {
            System.Threading.Interlocked.Decrement(ref _readyCount);

            if (_readyCount == 0)
            {
                //signal failure??
                return;
            }

            System.Threading.Interlocked.Increment(ref _processingCount);

            if (NSQMessageRecieved != null)
                NSQMessageRecieved(this, e);

            System.Threading.Interlocked.Decrement(ref _processingCount);
            System.Threading.Interlocked.Increment(ref _readyCount);
            UpdateReadyCount();
        }