public void Process(BaseAction action) { int size = _queue.Count; if (size > MaxQueueSize) { // drop the message // TODO: log it } else { _queue.Enqueue(action); } }
public void Process(BaseAction action) { requestHandler.Poll(); int size = actionQueue.Count; if (size > maxQueueSize) { // drop the message } else { actionQueue.Enqueue(action); } if (size+1 >= minBatchSize && DateTime.Now > nextFlushTime && requestHandler.IsReady()) { FlushOne(); nextFlushTime = DateTime.Now.Add(minInterval); } }
void Client_Succeeded(BaseAction action) { Console.WriteLine(String.Format("Action {0} succeeded.", action.GetAction())); }
void Client_Failed(BaseAction action, System.Exception e) { Console.WriteLine(String.Format("Action {0} failed : {1}", action.GetAction(), e.Message)); }
public void Process(BaseAction action) { Batch batch = _batchFactory.Create(new List<BaseAction>() { action }); _requestHandler.MakeRequest(batch); }
private void Enqueue(BaseAction action) { _flushHandler.Process(action); this.Statistics.Submitted += 1; }
internal void RaiseSuccess(BaseAction action) { if (Succeeded != null) Succeeded(action); }
internal void RaiseFailure(BaseAction action, System.Exception e) { if (Failed != null) Failed(action, e); }