예제 #1
0
        public void Write()
        {
            BusConfiguration config = new BusConfiguration();

            config.EndpointName(endpointName);
            IEnumerable <Type> typesToScan = TypeScanner.NestedTypes <HeaderWriterError>(typeof(ConfigErrorQueue));

            config.TypesToScan(typesToScan);
            config.EnableInstallers();
            config.UsePersistence <InMemoryPersistence>();
            config.RegisterComponents(c => c.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall));
            using (UnicastBus bus = (UnicastBus)Bus.Create(config).Start())
            {
                bus.Builder.Build <BusNotifications>()
                .Errors
                .MessageSentToErrorQueue
                .Subscribe(e =>
                {
                    string headerText = HeaderWriter.ToFriendlyString <HeaderWriterError>(e.Headers);
                    headerText        = BehaviorCleaner.CleanStackTrace(headerText);
                    headerText        = StackTraceCleaner.CleanStackTrace(headerText);
                    SnippetLogger.Write(text: headerText, suffix: "Error", version: "5");
                    ManualResetEvent.Set();
                });
                bus.SendLocal(new MessageToSend());
                ManualResetEvent.WaitOne();
            }
        }
예제 #2
0
        public void Write()
        {
            BusConfiguration busConfiguration = new BusConfiguration();

            busConfiguration.EndpointName(endpointName);
            IEnumerable <Type> typesToScan = TypeScanner.NestedTypes <HeaderWriterSaga>(typeof(ConfigErrorQueue));

            busConfiguration.TypesToScan(typesToScan);
            busConfiguration.EnableInstallers();
            busConfiguration.UsePersistence <InMemoryPersistence>();
            busConfiguration.RegisterComponents(c => c.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall));
            using (UnicastBus bus = (UnicastBus)Bus.Create(busConfiguration).Start())
            {
                bus.SendLocal(new StartSaga1Message());
                CountdownEvent.Wait();
            }
        }
예제 #3
0
 public void Start()
 {
     bus.SendLocal(new Message());
 }