public ActiveObject(ILoopsFactory factory, Action <T> action, int capacity, TimeSpan interval = new TimeSpan()) { _loop = factory.Create(LoopAction, interval); _queue = new BlockingCollection <Message>(new ConcurrentQueue <Message>()); _action = action; _capacity = capacity; _interval = interval; }
public static IStatefullLoop <T> CreateWith <T>(this ILoopsFactory factory, Action <CancellationToken, T> action, TimeSpan timeout = new TimeSpan()) { return(new StatefullLoop <T>(factory.Create(c => { }, timeout)).Loop(action)); }