예제 #1
0
 public void HandleSuccessMessage(IDictionary <string, object> meta)
 {
     _sentMessages.Dequeue();
     CurrentResultBuilder = _resultBuilders.Dequeue();
     if (meta.ContainsKey("fields"))
     {
         // first success
         CurrentResultBuilder?.CollectFields(meta);
     }
     else
     {
         // second success
         // before summary method is called
         CurrentResultBuilder?.CollectSummaryMeta(meta);
     }
     _logger?.Debug("S: ", new SuccessMessage(meta));
 }
        public void HandleFailureMessage(string code, string message)
        {
            DequeueMessage();
            var parts          = code.Split('.');
            var classification = parts[1].ToLowerInvariant();

            switch (classification)
            {
            case "clienterror":
                Error = new ClientException(code, message);
                break;

            case "transienterror":
                Error = new TransientException(code, message);
                break;

            default:
                Error = new DatabaseException(code, message);
                break;
            }
            CurrentResultBuilder?.InvalidateResult(); // an error received, so the result is broken
            _logger?.Debug("S: ", new FailureMessage(code, message));
        }
예제 #3
0
 public void HandleRecordMessage(object[] fields)
 {
     CurrentResultBuilder.Record(fields);
     _logger?.Debug("S: ", new RecordMessage(fields));
 }
 private void Interrupt()
 {
     // when receiving a reset, we will interrupt to not saving any incoming records by clean the result builder.
     CurrentResultBuilder?.InvalidateResult();
     CurrentResultBuilder = null;
 }
 public void HandleIgnoredMessage()
 {
     DequeueMessage();
     CurrentResultBuilder?.InvalidateResult(); // the result is ignored
     _logger?.Debug("S: ", new IgnoredMessage());
 }