示例#1
0
        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);
            }
        }
示例#3
0
 void Client_Succeeded(BaseAction action)
 {
     Console.WriteLine(String.Format("Action {0} succeeded.", action.GetAction()));
 }
示例#4
0
 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);
		}
示例#6
0
        private void Enqueue(BaseAction action)
        {
            _flushHandler.Process(action);

            this.Statistics.Submitted += 1;
        }
示例#7
0
 internal void RaiseSuccess(BaseAction action)
 {
     if (Succeeded != null) Succeeded(action);
 }
示例#8
0
 internal void RaiseFailure(BaseAction action, System.Exception e)
 {
     if (Failed != null) Failed(action, e);
 }