Ejemplo n.º 1
0
        protected virtual void Run()
        {
            try
            {
                for (;;)
                {
                    if (_stopped)
                    {
                        throw new Exception("Stopped by application");
                    }
                    if (DateTime.Now - _startDate > _lifeTime)
                    {
                        throw new Exception("Lifetime expired.");
                    }

                    _source.Consume(value =>
                    {
                        Handle(value);
                    });
                }
            }
            catch (ThreadAbortException e)
            {
                OnStoppedEvent(e);
                _stopException = e;
                _stopped       = true;
            }
            catch (Exceptions.ChannelDrainedException e)
            {
                OnStoppedEvent(e);
                _stopException = e;
                _stopped       = true;
            }
            catch (Exception e)
            {
                OnStoppedEvent(e);
                _stopException = e;
                _stopped       = true;
            }
        }
Ejemplo n.º 2
0
 public void Consume(Action <D> action)
 {
     _channel.Consume(t => action(Transform(t)));
 }
Ejemplo n.º 3
0
 public void Consume(Action <T> action)
 {
     _destiantion.Consume(action);
 }