Пример #1
0
            public void MutateIncoming(TransportMessage transportMessage)
            {
                var headerText = HeaderWriter.ToFriendlyString <HeaderWriterSend>(transportMessage.Headers);

                SnippetLogger.Write(headerText, version: "5");
                ManualResetEvent.Set();
            }
Пример #2
0
 public static void Write(string text, [CallerFilePath] string sourceFilePath = null, string suffix = "", string version = "")
 {
     using (SnippetLogger logger = new SnippetLogger(sourceFilePath, suffix, version))
     {
         logger.WriteLine(text);
     }
 }
Пример #3
0
 public static void Write(string text, [CallerFilePath] string sourceFilePath = null, string suffix = "", string version = "")
 {
     using (SnippetLogger logger = new SnippetLogger(sourceFilePath, suffix, version))
     {
         logger.WriteLine(text);
     }
 }
            public void MutateIncoming(TransportMessage transportMessage)
            {
                if (transportMessage.IsMessageOfTye <SendFromSagaMessage>())
                {
                    string headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(transportMessage.Headers);
                    SnippetLogger.Write(text: headerText, suffix: "Sending", version: "All");
                    CountdownEvent.Signal();
                    return;
                }
                if (transportMessage.IsMessageOfTye <ReplyFromSagaMessage>())
                {
                    string headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(transportMessage.Headers);
                    SnippetLogger.Write(text: headerText, suffix: "Replying", version: "All");
                    CountdownEvent.Signal();
                    return;
                }
                if (transportMessage.IsMessageOfTye <ReplyToOriginatorFromSagaMessage>())
                {
                    string headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(transportMessage.Headers);
                    SnippetLogger.Write(text: headerText, suffix: "ReplyingToOriginator", version: "All");
                    CountdownEvent.Signal();
                    return;
                }

                if (transportMessage.IsMessageOfTye <TimeoutFromSaga>())
                {
                    string headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(transportMessage.Headers);
                    SnippetLogger.Write(text: headerText, suffix: "Timeout", version: "All");
                    CountdownEvent.Signal();
                    return;
                }
            }
Пример #5
0
            public Task MutateIncoming(MutateIncomingTransportMessageContext context)
            {
                if (context.IsMessageOfTye <SendFromSagaMessage>())
                {
                    string headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(context.Headers);
                    SnippetLogger.Write(text: headerText, suffix: "Sending", version: "6");
                    CountdownEvent.Signal();
                    return(Task.FromResult(0));
                }
                if (context.IsMessageOfTye <ReplyFromSagaMessage>())
                {
                    string headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(context.Headers);
                    SnippetLogger.Write(text: headerText, suffix: "Replying", version: "6");
                    CountdownEvent.Signal();
                    return(Task.FromResult(0));
                }
                if (context.IsMessageOfTye <ReplyToOriginatorFromSagaMessage>())
                {
                    string headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(context.Headers);
                    SnippetLogger.Write(text: headerText, suffix: "ReplyingToOriginator", version: "6");
                    CountdownEvent.Signal();
                    return(Task.FromResult(0));
                }

                if (context.IsMessageOfTye <TimeoutFromSaga>())
                {
                    string 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)
 {
     string headerText = HeaderWriter.ToFriendlyString<HeaderWriterDefer>(context.Headers);
     SnippetLogger.Write(headerText, version: "6");
     ManualResetEvent.Set();
     return Task.FromResult(0);
 }
Пример #7
0
        public void Write()
        {
            var busConfiguration = new BusConfiguration();

            busConfiguration.EndpointName(endpointName);
            var typesToScan = TypeScanner.NestedTypes <HeaderWriterError>(typeof(ConfigErrorQueue));

            busConfiguration.TypesToScan(typesToScan);
            busConfiguration.EnableInstallers();
            busConfiguration.UsePersistence <InMemoryPersistence>();
            busConfiguration.RegisterComponents(c => c.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall));
            using (var bus = (UnicastBus)Bus.Create(busConfiguration).Start())
            {
                bus.Builder.Build <BusNotifications>()
                .Errors
                .MessageSentToErrorQueue
                .Subscribe(e =>
                {
                    var headerText = HeaderWriter.ToFriendlyString <HeaderWriterError>(e.Headers);
                    headerText     = BehaviorCleaner.CleanStackTrace(headerText);
                    headerText     = StackTraceCleaner.CleanStackTrace(headerText);
                    SnippetLogger.Write(text: headerText, suffix: "Error", version: "5");
                    ManualResetEvent.Set();
                });
                var messageToSend = new MessageToSend();
                bus.SendLocal(messageToSend);
                ManualResetEvent.WaitOne();
            }
        }
Пример #8
0
        public void MutateIncoming(TransportMessage transportMessage)
        {
            string headerText = HeaderWriter.ToFriendlyString <HeaderWriterPublish>(transportMessage.Headers);

            SnippetLogger.Write(headerText);
            ManualResetEvent.Set();
        }
Пример #9
0
            public void MutateIncoming(TransportMessage transportMessage)
            {
                var headerText = HeaderWriter.ToFriendlyString <HeaderWriterDataBusProperty>(transportMessage.Headers);

                SnippetLogger.Write(headerText);
                SnippetLogger.Write(Encoding.Default.GetString(transportMessage.Body), suffix: "Body");
                ManualResetEvent.Set();
            }
Пример #10
0
            public Task MutateIncoming(MutateIncomingTransportMessageContext context)
            {
                var headerText = HeaderWriter.ToFriendlyString <HeaderWriterSend>(context.Headers);

                SnippetLogger.Write(headerText);
                ManualResetEvent.Set();
                return(Task.FromResult(0));
            }
Пример #11
0
            public Task MutateIncoming(MutateIncomingTransportMessageContext context)
            {
                var headerText = HeaderWriter.ToFriendlyString <HeaderWriterPublish>(context.Headers);

                SnippetLogger.Write(headerText);
                ManualResetEvent.Set();
                return(Task.CompletedTask);
            }
            public void MutateIncoming(TransportMessage transportMessage)
            {
                string headerText = HeaderWriter.ToFriendlyString <HeaderWriterEncryption>(transportMessage.Headers);

                SnippetLogger.Write(headerText, version: "5");
                SnippetLogger.Write(Encoding.Default.GetString(transportMessage.Body), version: "5", suffix: "Body");
                ManualResetEvent.Set();
            }
            public Task MutateIncoming(MutateIncomingTransportMessageContext context)
            {
                var headerText = HeaderWriter.ToFriendlyString <HeaderWriterDataBusProperty>(context.Headers);

                SnippetLogger.Write(headerText);
                SnippetLogger.Write(Encoding.Default.GetString(context.Body), suffix: "Body");
                ManualResetEvent.Set();
                return(Task.CompletedTask);
            }
            public Task MutateIncoming(MutateIncomingTransportMessageContext context)
            {
                string headerText = HeaderWriter.ToFriendlyString <HeaderWriterDataBusProperty>(context.Headers);

                SnippetLogger.Write(headerText, version: "6");
                SnippetLogger.Write(Encoding.Default.GetString(context.Body), version: "6", suffix: "Body");
                ManualResetEvent.Set();
                return(Task.FromResult(0));
            }
            public void MutateIncoming(TransportMessage transportMessage)
            {
                string headerText = HeaderWriter.ToFriendlyString <HeaderWriterDataBusConvention>(transportMessage.Headers)
                                    .Replace(typeof(MessageToSend).FullName, "MessageToSend");

                SnippetLogger.Write(headerText, version: "5");
                SnippetLogger.Write(Encoding.Default.GetString(transportMessage.Body), version: "5", suffix: "Body");
                ManualResetEvent.Set();
            }
Пример #16
0
 public void MutateIncoming(TransportMessage transportMessage)
 {
     if (!hasCapturedMessage && transportMessage.IsMessageOfTye <MessageToSend>())
     {
         hasCapturedMessage = true;
         var sendingText = HeaderWriter.ToFriendlyString <HeaderWriterError>(transportMessage.Headers);
         SnippetLogger.Write(text: sendingText, suffix: "Sending", version: "5");
     }
 }
            public Task MutateIncoming(MutateIncomingTransportMessageContext context)
            {
                var headerText = HeaderWriter.ToFriendlyString <HeaderWriterEncryption>(context.Headers);

                SnippetLogger.Write(headerText);
                SnippetLogger.Write(Encoding.Default.GetString(context.Body),
                                    suffix: "Body");
                ManualResetEvent.Set();
                return(Task.FromResult(0));
            }
Пример #18
0
            public Task MutateIncoming(MutateIncomingTransportMessageContext context)
            {
                var headerText = HeaderWriter.ToFriendlyString <HeaderWriterDataBusConvention>(context.Headers)
                                 .Replace(typeof(MessageToSend).FullName, "MessageToSend");

                SnippetLogger.Write(headerText, version: "6");
                SnippetLogger.Write(Encoding.Default.GetString(context.Body), version: "6", suffix: "Body");
                ManualResetEvent.Set();
                return(Task.FromResult(0));
            }
 public Task MutateIncoming(MutateIncomingTransportMessageContext context)
 {
     if (!hasCapturedMessage && context.IsMessageOfTye <MessageToSend>())
     {
         hasCapturedMessage = true;
         string sendingText = HeaderWriter.ToFriendlyString <HeaderWriterError>(context.Headers);
         SnippetLogger.Write(text: sendingText, suffix: "Sending", version: "6");
     }
     return(Task.FromResult(0));
 }
            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);
            }
 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());
 }
Пример #22
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);
 }
Пример #23
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();
                };
            }
Пример #24
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();
     }
 }
 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");
     }
 }
Пример #26
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 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));
 }
Пример #28
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));
            }
Пример #29
0
            public Task MutateIncoming(MutateIncomingTransportMessageContext context)
            {
                var headers = context.Headers;

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

                if (context.IsMessageOfTye <TimeoutFromSaga>())
                {
                    var headerText = HeaderWriter.ToFriendlyString <HeaderWriterSaga>(headers);
                    SnippetLogger.Write(
                        text: headerText,
                        suffix: "Timeout");
                    CountdownEvent.Signal();
                    return(Task.CompletedTask);
                }
                return(Task.CompletedTask);
            }
            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);
            }
Пример #31
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);
            }