public void MutateIncoming(TransportMessage transportMessage)
 {
     if (!hasCapturedMessage && transportMessage.IsMessageOfTye <MessageToSend>())
     {
         hasCapturedMessage = true;
         var headers     = transportMessage.Headers;
         var sendingText = HeaderWriter.ToFriendlyString <HeaderWriterError>(headers);
         SnippetLogger.Write(
             text: sendingText,
             suffix: "Sending");
     }
 }
 public override Task Invoke(IIncomingLogicalMessageContext context, Func <Task> next)
 {
     if (!hasCapturedMessage && context.Message.Instance is MessageToSend)
     {
         hasCapturedMessage = true;
         var headers     = context.Headers;
         var sendingText = HeaderWriter.ToFriendlyString <HeaderWriterError>(headers);
         SnippetLogger.Write(
             text: sendingText,
             suffix: "Sending");
     }
     return(next());
 }
            public override Task Invoke(IIncomingPhysicalMessageContext context, Func <Task> next)
            {
                var headers    = context.MessageHeaders;
                var headerText = HeaderWriter.ToFriendlyString <HeaderWriterError>(headers);

                headerText = BehaviorCleaner.CleanStackTrace(headerText);
                headerText = StackTraceCleaner.CleanStackTrace(headerText);
                SnippetLogger.Write(
                    text: headerText,
                    suffix: "Error");
                ManualResetEvent.Set();
                return(Task.CompletedTask);
            }
예제 #4
0
 public Task MutateIncoming(MutateIncomingTransportMessageContext context)
 {
     if (!hasCapturedMessage && context.IsMessageOfTye <MessageToSend>())
     {
         hasCapturedMessage = true;
         var headers     = context.Headers;
         var sendingText = HeaderWriter.ToFriendlyString <HeaderWriterError>(headers);
         SnippetLogger.Write(
             text: sendingText,
             suffix: "Sending");
     }
     return(Task.CompletedTask);
 }
예제 #5
0
            public Mutator(Notifications busNotifications)
            {
                var errorsNotifications = busNotifications.Errors;

                errorsNotifications.MessageSentToErrorQueue += (sender, retry) =>
                {
                    var headerText = HeaderWriter.ToFriendlyString <HeaderWriterError>(retry.Headers);
                    headerText = BehaviorCleaner.CleanStackTrace(headerText);
                    headerText = StackTraceCleaner.CleanStackTrace(headerText);
                    SnippetLogger.Write(text: headerText, suffix: "Error", version: "6");
                    ManualResetEvent.Set();
                };
            }
예제 #6
0
 public Task MutateIncoming(MutateIncomingTransportMessageContext context)
 {
     if (!hasCapturedMessage && context.IsMessageOfTye <MessageToSend>())
     {
         hasCapturedMessage = true;
         var sendingText = HeaderWriter.ToFriendlyString <HeaderWriterError>(context.Headers);
         SnippetLogger.Write(
             text: sendingText,
             suffix: "Sending",
             version: "6");
     }
     return(Task.FromResult(0));
 }
예제 #7
0
 public void MutateIncoming(TransportMessage transportMessage)
 {
     if (transportMessage.IsMessageOfTye <MessageToSend>())
     {
         string sendingText = HeaderWriter.ToFriendlyString <HeaderWriterReturn>(transportMessage.Headers);
         SnippetLogger.Write(text: sendingText, suffix: "Sending", version: "5");
     }
     else
     {
         string returnText = HeaderWriter.ToFriendlyString <HeaderWriterReturn>(transportMessage.Headers);
         SnippetLogger.Write(text: returnText, suffix: "Returning", version: "5");
         ManualResetEvent.Set();
     }
 }
예제 #8
0
            public void MutateIncoming(TransportMessage transportMessage)
            {
                if (!receivedFirstMessage)
                {
                    receivedFirstMessage = true;
                    var sendText = HeaderWriter.ToFriendlyString <HeaderWriterAudit>(transportMessage.Headers);
                    SnippetLogger.Write(text: sendText, suffix: "Send");
                    return;
                }
                var auditText = HeaderWriter.ToFriendlyString <HeaderWriterAudit>(transportMessage.Headers);

                SnippetLogger.Write(text: auditText, suffix: "Audit");
                ManualResetEvent.Set();
            }
 public void MutateIncoming(TransportMessage transportMessage)
 {
     if (transportMessage.IsMessageOfTye <MessageToReply>())
     {
         string headerText = HeaderWriter.ToFriendlyString <HeaderWriterReply>(transportMessage.Headers);
         SnippetLogger.Write(text: headerText, suffix: "Replying", version: "All");
         ManualResetEvent.Set();
     }
     if (transportMessage.IsMessageOfTye <MessageToSend>())
     {
         string headerText = HeaderWriter.ToFriendlyString <HeaderWriterReply>(transportMessage.Headers);
         SnippetLogger.Write(text: headerText, suffix: "Sending", version: "All");
     }
 }
예제 #10
0
            public Task MutateIncoming(MutateIncomingTransportMessageContext context)
            {
                if (!receivedFirstMessage)
                {
                    receivedFirstMessage = true;
                    string sendText = HeaderWriter.ToFriendlyString <HeaderWriterAudit>(context.Headers);
                    SnippetLogger.Write(text: sendText, suffix: "Send", version: "6");
                    return(Task.FromResult(0));
                }
                string auditText = HeaderWriter.ToFriendlyString <HeaderWriterAudit>(context.Headers);

                SnippetLogger.Write(text: auditText, suffix: "Audit", version: "6");
                ManualResetEvent.Set();
                return(Task.FromResult(0));
            }
 public Task MutateIncoming(MutateIncomingTransportMessageContext context)
 {
     if (context.IsMessageOfTye <MessageToReply>())
     {
         string headerText = HeaderWriter.ToFriendlyString <HeaderWriterReply>(context.Headers);
         SnippetLogger.Write(text: headerText, suffix: "Replying", version: "6");
         ManualResetEvent.Set();
     }
     if (context.IsMessageOfTye <MessageToSend>())
     {
         string headerText = HeaderWriter.ToFriendlyString <HeaderWriterReply>(context.Headers);
         SnippetLogger.Write(text: headerText, suffix: "Sending", version: "6");
     }
     return(Task.FromResult(0));
 }
예제 #12
0
            public Task MutateIncoming(MutateIncomingTransportMessageContext context)
            {
                if (context.IsMessageOfTye <SendFromSagaMessage>())
                {
                    var headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(context.Headers);
                    SnippetLogger.Write(
                        text: headerText,
                        suffix: "Sending",
                        version: "6");
                    CountdownEvent.Signal();
                    return(Task.FromResult(0));
                }
                if (context.IsMessageOfTye <ReplyFromSagaMessage>())
                {
                    var headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(context.Headers);
                    SnippetLogger.Write(
                        text: headerText,
                        suffix: "Replying",
                        version: "6");
                    CountdownEvent.Signal();
                    return(Task.FromResult(0));
                }
                if (context.IsMessageOfTye <ReplyToOriginatorFromSagaMessage>())
                {
                    var headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(context.Headers);
                    SnippetLogger.Write(
                        text: headerText,
                        suffix: "ReplyingToOriginator",
                        version: "6");
                    CountdownEvent.Signal();
                    return(Task.FromResult(0));
                }

                if (context.IsMessageOfTye <TimeoutFromSaga>())
                {
                    var headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(context.Headers);
                    SnippetLogger.Write(
                        text: headerText,
                        suffix: "Timeout",
                        version: "6");
                    CountdownEvent.Signal();
                    return(Task.FromResult(0));
                }
                return(Task.FromResult(0));
            }
            public Task MutateIncoming(MutateIncomingTransportMessageContext context)
            {
                if (!receivedFirstMessage)
                {
                    receivedFirstMessage = true;
                    var sendText = HeaderWriter.ToFriendlyString <HeaderWriterAudit>(context.Headers);
                    SnippetLogger.Write(
                        text: sendText,
                        suffix: "Send");
                    return(Task.CompletedTask);
                }
                var auditText = HeaderWriter.ToFriendlyString <HeaderWriterAudit>(context.Headers);

                SnippetLogger.Write(
                    text: auditText,
                    suffix: "Audit");
                ManualResetEvent.Set();
                return(Task.CompletedTask);
            }
예제 #14
0
            public void MutateIncoming(TransportMessage transportMessage)
            {
                var headers = transportMessage.Headers;

                if (transportMessage.IsMessageOfTye <SendFromSagaMessage>())
                {
                    var headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(headers);
                    SnippetLogger.Write(
                        text: headerText,
                        suffix: "Sending");
                    CountdownEvent.Signal();
                    return;
                }
                if (transportMessage.IsMessageOfTye <ReplyFromSagaMessage>())
                {
                    var headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(headers);
                    SnippetLogger.Write(
                        text: headerText,
                        suffix: "Replying");
                    CountdownEvent.Signal();
                    return;
                }
                if (transportMessage.IsMessageOfTye <ReplyToOriginatorFromSagaMessage>())
                {
                    var headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(headers);
                    SnippetLogger.Write(
                        text: headerText,
                        suffix: "ReplyingToOriginator");
                    CountdownEvent.Signal();
                    return;
                }

                if (transportMessage.IsMessageOfTye <TimeoutFromSaga>())
                {
                    var headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(headers);
                    SnippetLogger.Write(
                        text: headerText,
                        suffix: "Timeout");
                    CountdownEvent.Signal();
                }
            }
예제 #15
0
            public Task MutateIncoming(MutateIncomingTransportMessageContext context)
            {
                var headers = context.Headers;

                if (context.IsMessageOfTye <MessageToSend>())
                {
                    var sendingText = HeaderWriter.ToFriendlyString <HeaderWriterReturn>(headers);
                    SnippetLogger.Write(
                        text: sendingText,
                        suffix: "Sending");
                }
                else
                {
                    var returnText = HeaderWriter.ToFriendlyString <HeaderWriterReturn>(headers);
                    SnippetLogger.Write(
                        text: returnText,
                        suffix: "Returning");
                    ManualResetEvent.Set();
                }
                return(Task.CompletedTask);
            }
예제 #16
0
    public async Task Write()
    {
        var endpointConfiguration = new EndpointConfiguration("StartUpDiagnosticsWriter");
        var typesToScan           = TypeScanner.NestedTypes <HeaderWriterSend>();

        endpointConfiguration.SetTypesToScan(typesToScan);
        endpointConfiguration.UseTransport <LearningTransport>();
        string diagnostics = null;

        endpointConfiguration.CustomDiagnosticsWriter(x =>
        {
            diagnostics = x;
            return(Task.CompletedTask);
        });

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
                               .ConfigureAwait(false);

        var jsonFormatted = JToken.Parse(diagnostics).ToString(Formatting.Indented);
        var substring     = string.Join("\r", jsonFormatted.Split('\r').Take(20)) + "\r\n...";

        SnippetLogger.Write(substring);
        await endpointInstance.Stop();
    }