Esempio n. 1
0
 public override string ToString()
 {
     return(Item.PrintToString(o =>
     {
         string details = JsvFormatter.Format(JsonSerializer.SerializeToString(o));
         string description;
         if (Describe.TryDescribe(o, out description))
         {
             return "\r\n" + Indent(description) + "\r\n\r\n" + details;
         }
         return details;
     }));
 }
Esempio n. 2
0
        public bool TryToQuarantine(ImmutableEnvelope envelope, Exception ex)
        {
            var quarantined = _quarantine.TryToQuarantine(envelope, ex);


            try
            {
                var item = GetStreamingItem(envelope.CreatedOnUtc, envelope.EnvelopeId);
                var data = "";
                try
                {
                    data = item.ReadText();
                }
                catch (StreamingItemNotFoundException) { }

                var builder = new StringBuilder(data);
                if (builder.Length == 0)
                {
                    builder.AppendLine(envelope.PrintToString(o => o.SerializeAndFormat()));
                }

                builder.AppendLine("[Exception]");
                builder.AppendLine(DateTime.UtcNow.ToString());
                builder.AppendLine(ex.ToString());
                builder.AppendLine();

                var text = builder.ToString();
                item.WriteText(text);

                if (quarantined)
                {
                    ReportFailure(text, envelope);
                }
            }
            catch (Exception x)
            {
                Trace.WriteLine(x.ToString());
            }

            return(quarantined);
        }
        public override string ToString()
        {
            return(Item.PrintToString(o =>
            {
                var details = JsvFormatter.Format(JsonSerializer.SerializeToString(o));

                var ie = o as IEvent <IIdentity>;

                //if (ie != null)
                //{
                //    details = details + "\r\n From:" + IdentityConvert.ToPartitionedName(ie.Id);
                //}

                string description;
                if (Describe.TryDescribe(o, out description))
                {
                    return "\r\n" + Indent(description) + "\r\n\r\n" + details;
                }
                return details;
            }));
        }
 static void DescribeMessage(StringBuilder builder, ImmutableEnvelope context)
 {
     builder.AppendLine(context.PrintToString(o => JsvFormatter.Format(JsonSerializer.SerializeToString(o))));
 }
 static void DescribeMessage(StringBuilder builder, ImmutableEnvelope context)
 {
     builder.AppendLine(context.PrintToString(o => JsvFormatter.Format(JsonSerializer.SerializeToString(o))));
 }
Esempio n. 6
0
        public bool TryToQuarantine(ImmutableEnvelope envelope, Exception ex)
        {
            var quarantined = _quarantine.TryToQuarantine(envelope, ex);

            try
            {
                var item = GetStreamingItem(envelope.CreatedOnUtc, envelope.EnvelopeId);
                var data = "";
                try
                {
                    data = item.ReadText();
                }
                catch (StreamingItemNotFoundException) { }

                var builder = new StringBuilder(data);
                if (builder.Length == 0)
                {
                    builder.AppendLine(envelope.PrintToString(o => o.SerializeAndFormat()));
                }

                builder.AppendLine("[Exception]");
                builder.AppendLine(DateTime.UtcNow.ToString());
                builder.AppendLine(ex.ToString());
                builder.AppendLine();

                var text = builder.ToString();
                item.WriteText(text);

                if (quarantined)
                    ReportFailure(text, envelope);
            }
            catch (Exception x)
            {
                Trace.WriteLine(x.ToString());
            }

            return quarantined;
        }