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; } }
public void Consume(Action <D> action) { _channel.Consume(t => action(Transform(t))); }
public void Consume(Action <T> action) { _destiantion.Consume(action); }