예제 #1
0
        Task <IEndpointInstance> StartBus()
        {
            var logFactory = LogManager.Use <DefaultFactory>();

            logFactory.Level(LogLevel.Warn);
            var endpointConfiguration = new EndpointConfiguration(endpointName);

            endpointConfiguration.SendFailedMessagesTo(errorQueueName);
            endpointConfiguration.UseSerialization <JsonSerializer>();
            var recoverability = endpointConfiguration.Recoverability();

            recoverability.Immediate(
                customizations: setting =>
            {
                setting.NumberOfRetries(0);
            });
            var transport = endpointConfiguration.UseTransport <RabbitMQTransport>();

            transport.ConnectionString("host=localhost");
            var rabbitTypes = typeof(RabbitMQTransport).Assembly.GetTypes();
            var typesToScan = TypeScanner.NestedTypes <Tests>(rabbitTypes);

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.EnableInstallers();
            endpointConfiguration.UsePersistence <InMemoryPersistence>();
            return(Endpoint.Start(endpointConfiguration));
        }
예제 #2
0
        public async Task Write()
        {
            var endpointConfiguration = new EndpointConfiguration(endpointName);
            var dataBus = endpointConfiguration.UseDataBus <FileShareDataBus>();

            dataBus.BasePath(@"..\..\..\storage");
            var typesToScan = TypeScanner.NestedTypes <HeaderWriterDataBusConvention>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.UseTransport <LearningTransport>();
            var conventions = endpointConfiguration.Conventions();

            conventions.DefiningDataBusPropertiesAs(property =>
            {
                return(property.Name.StartsWith("LargeProperty"));
            });
            endpointConfiguration.RegisterMessageMutator(new Mutator());

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

            var messageToSend = new MessageToSend
            {
                LargeProperty1 = new byte[10],
                LargeProperty2 = new byte[10]
            };
            await endpointInstance.SendLocal(messageToSend)
            .ConfigureAwait(false);

            ManualResetEvent.WaitOne();
            await endpointInstance.Stop()
            .ConfigureAwait(false);
        }
        public async Task Write()
        {
            var endpointConfiguration = new EndpointConfiguration(endpointName);
            var typesToScan           = TypeScanner.NestedTypes <HeaderWriterAudit>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.EnableInstallers();
            endpointConfiguration.SendFailedMessagesTo("error");
            endpointConfiguration.AuditProcessedMessagesTo(endpointName);
            endpointConfiguration.UsePersistence <InMemoryPersistence>();
            endpointConfiguration.RegisterComponents(
                registration: components =>
            {
                components.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall);
            });

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

            await endpointInstance.SendLocal(new MessageToSend())
            .ConfigureAwait(false);

            ManualResetEvent.WaitOne();
            await endpointInstance.Stop()
            .ConfigureAwait(false);
        }
        public async Task Write()
        {
            var endpointConfiguration = new EndpointConfiguration(endpointName);

            endpointConfiguration.SendFailedMessagesTo("error");
            var typesToScan = TypeScanner.NestedTypes <HeaderWriterError>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.EnableInstallers();
            endpointConfiguration.UsePersistence <InMemoryPersistence>();
            endpointConfiguration.RegisterComponents(
                registration: components =>
            {
                components.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall);
            });
            var recoverability = endpointConfiguration.Recoverability();

            recoverability.Immediate(settings => settings.NumberOfRetries(1));
            recoverability.Delayed(settings =>
            {
                settings.NumberOfRetries(0);
            });

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

            await endpointInstance.SendLocal(new MessageToSend())
            .ConfigureAwait(false);

            ManualResetEvent.WaitOne();
        }
        public async Task Write()
        {
            var endpointConfiguration = new EndpointConfiguration(endpointName);

            endpointConfiguration.SendFailedMessagesTo("error");
            var typesToScan = TypeScanner.NestedTypes <HeaderWriterError>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.EnableInstallers();
            endpointConfiguration.UseTransport <LearningTransport>();
            endpointConfiguration.Pipeline.Register(typeof(Mutator), "Capture headers on failed messages");

            var recoverability = endpointConfiguration.Recoverability();

            recoverability.Immediate(settings => settings.NumberOfRetries(1));
            recoverability.Delayed(settings =>
            {
                settings.NumberOfRetries(0);
            });

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

            await endpointInstance.SendLocal(new MessageToSend())
            .ConfigureAwait(false);

            ManualResetEvent.WaitOne();
        }
        public async Task Write()
        {
            var endpointConfiguration = new EndpointConfiguration(endpointName);

            endpointConfiguration.RijndaelEncryptionService("2015-10", Encoding.ASCII.GetBytes("gdDbqRpqdRbTs3mhdZh9qCaDaxJXl+e6"));
            endpointConfiguration.Conventions().DefiningEncryptedPropertiesAs(info => info.Name.StartsWith("EncryptedProperty"));
            var typesToScan = TypeScanner.NestedTypes <HeaderWriterEncryption>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.SendFailedMessagesTo("error");
            endpointConfiguration.EnableInstallers();
            endpointConfiguration.UsePersistence <InMemoryPersistence>();
            endpointConfiguration.RegisterComponents(c => c.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall));
            var endpointInstance = await Endpoint.Start(endpointConfiguration)
                                   .ConfigureAwait(false);

            var messageToSend = new MessageToSend
            {
                EncryptedProperty1 = "String 1",
                EncryptedProperty2 = "String 2"
            };
            await endpointInstance.SendLocal(messageToSend)
            .ConfigureAwait(false);

            ManualResetEvent.WaitOne();
        }
예제 #7
0
    public async Task Write(TransportTransactionMode transactionMode)
    {
        var endpointConfiguration = EndpointConfigBuilder.BuildEndpoint(nameof(TransportIntegrationTests));
        var typesToScan           = TypeScanner.NestedTypes <TransportIntegrationTests>();

        endpointConfiguration.SetTypesToScan(typesToScan);
        var transport = endpointConfiguration.UseTransport <SqlServerTransport>();

        transport.UseCustomSqlConnectionFactory(async() =>
        {
            var connection = MsSqlConnectionBuilder.Build();
            await connection.OpenAsync().ConfigureAwait(false);
            return(connection);
        });
        transport.Transactions(transactionMode);
        var persistence = endpointConfiguration.UsePersistence <SqlPersistence>();

        persistence.SqlDialect <SqlDialect.MsSqlServer>();
        persistence.ConnectionBuilder(MsSqlConnectionBuilder.Build);
        persistence.DisableInstaller();
        persistence.SubscriptionSettings().DisableCache();

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

        var startSagaMessage = new StartSagaMessage
        {
            StartId = Guid.NewGuid()
        };
        await endpoint.SendLocal(startSagaMessage).ConfigureAwait(false);

        Assert.IsTrue(ManualResetEvent.WaitOne(TimeSpan.FromSeconds(30)));
        await endpoint.Stop().ConfigureAwait(false);
    }
        public async Task Write()
        {
            var endpointConfiguration = new EndpointConfiguration(EndpointName);
            var typesToScan           = TypeScanner.NestedTypes <HeaderWriterPublish>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.SendFailedMessagesTo("error");
            endpointConfiguration.EnableInstallers();
            endpointConfiguration.UsePersistence <InMemoryPersistence>();
            endpointConfiguration.RegisterMessageMutator(new Mutator());
            var routing = endpointConfiguration.UseTransport <MsmqTransport>().Routing();

            routing.RegisterPublisher(GetType().Assembly, EndpointName);
            var endpointInstance = await Endpoint.Start(endpointConfiguration)
                                   .ConfigureAwait(false);

            // give time for the subscription to happen
            await Task.Delay(3000)
            .ConfigureAwait(false);

            await endpointInstance.Publish(new MessageToPublish())
            .ConfigureAwait(false);

            ManualResetEvent.WaitOne();
            await endpointInstance.Stop()
            .ConfigureAwait(false);
        }
        public async Task Write()
        {
            EndpointConfiguration endpointConfiguration = new EndpointConfiguration(endpointName);
            var dataBus = endpointConfiguration.UseDataBus <FileShareDataBus>();

            dataBus.BasePath(@"..\..\..\storage");
            IEnumerable <Type> typesToScan = TypeScanner.NestedTypes <HeaderWriterDataBusConvention>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.SendFailedMessagesTo("error");
            endpointConfiguration.EnableInstallers();
            endpointConfiguration.Conventions().DefiningDataBusPropertiesAs(x => x.Name.StartsWith("LargeProperty"));
            endpointConfiguration.UsePersistence <InMemoryPersistence>();
            endpointConfiguration.RegisterComponents(c => c.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall));

            IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);

            await endpoint.SendLocal(new MessageToSend
            {
                LargeProperty1 = new byte[10],
                LargeProperty2 = new byte[10]
            });

            ManualResetEvent.WaitOne();
            await endpoint.Stop();
        }
        public void Write()
        {
            var busConfiguration = new BusConfiguration();

            busConfiguration.EndpointName(endpointName);
            var dataBus = busConfiguration.UseDataBus <FileShareDataBus>();

            dataBus.BasePath(@"..\..\..\storage");
            var typesToScan = TypeScanner.NestedTypes <HeaderWriterDataBusProperty>(typeof(ConfigErrorQueue));

            busConfiguration.TypesToScan(typesToScan);
            busConfiguration.EnableInstallers();
            busConfiguration.UsePersistence <InMemoryPersistence>();
            busConfiguration.RegisterComponents(c => c.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall));
            using (var bus = Bus.Create(busConfiguration).Start())
            {
                var messageToSend = new MessageToSend
                {
                    LargeProperty1 = new DataBusProperty <byte[]>(new byte[10]),
                    LargeProperty2 = new DataBusProperty <byte[]>(new byte[10])
                };
                bus.SendLocal(messageToSend);
                ManualResetEvent.WaitOne();
            }
        }
        public async Task Write()
        {
            var endpointConfiguration = new EndpointConfiguration(endpointName);
            var encryptionService     = new RijndaelEncryptionService(
                encryptionKeyIdentifier: "2015-10",
                key: Convert.FromBase64String("gdDbqRpqdRbTs3mhdZh9qCaDaxJXl+e6"));

            endpointConfiguration.EnableMessagePropertyEncryption(
                encryptionService: encryptionService,
                encryptedPropertyConvention: propertyInfo =>
            {
                return(propertyInfo.Name.EndsWith("EncryptedProperty"));
            }
                );

            var conventions = endpointConfiguration.Conventions();
            var typesToScan = TypeScanner.NestedTypes <HeaderWriterEncryption>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.UseTransport <LearningTransport>();
            endpointConfiguration.RegisterMessageMutator(new Mutator());

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

            var messageToSend = new MessageToSend
            {
                EncryptedProperty1 = "String 1",
                EncryptedProperty2 = "String 2"
            };
            await endpointInstance.SendLocal(messageToSend)
            .ConfigureAwait(false);

            ManualResetEvent.WaitOne();
        }
        public void Write()
        {
            var busConfiguration = new BusConfiguration();

            busConfiguration.EndpointName(endpointName);
            busConfiguration.RijndaelEncryptionService("key1", Convert.FromBase64String("gdDbqRpqdRbTs3mhdZh9qCaDaxJXl+e6"));
            var conventions = busConfiguration.Conventions();

            conventions.DefiningEncryptedPropertiesAs(info => info.Name.StartsWith("EncryptedProperty"));
            var typesToScan = TypeScanner.NestedTypes <HeaderWriterEncryption>(typeof(ConfigErrorQueue));

            busConfiguration.TypesToScan(typesToScan);
            busConfiguration.EnableInstallers();
            busConfiguration.UsePersistence <InMemoryPersistence>();
            busConfiguration.RegisterComponents(
                registration: components =>
            {
                components.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall);
            });
            using (var bus = Bus.Create(busConfiguration).Start())
            {
                var messageToSend = new MessageToSend
                {
                    EncryptedProperty1 = "String 1",
                    EncryptedProperty2 = "String 2"
                };
                bus.SendLocal(messageToSend);
                ManualResetEvent.WaitOne();
            }
        }
예제 #13
0
        public async Task Write()
        {
            var endpointConfiguration = new EndpointConfiguration(endpointName);

#pragma warning disable 618
            endpointConfiguration.RijndaelEncryptionService("2015-10", Encoding.ASCII.GetBytes("gdDbqRpqdRbTs3mhdZh9qCaDaxJXl+e6"));
#pragma warning restore 618
            var conventions = endpointConfiguration.Conventions();
#pragma warning disable 618
            conventions.DefiningEncryptedPropertiesAs(info => info.Name.StartsWith("EncryptedProperty"));
#pragma warning restore 618
            var typesToScan = TypeScanner.NestedTypes <HeaderWriterEncryption>();
            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.UsePersistence <LearningPersistence>();
            endpointConfiguration.UseTransport <LearningTransport>();
            endpointConfiguration.RegisterComponents(
                registration: components =>
            {
                components.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall);
            });
            var endpointInstance = await Endpoint.Start(endpointConfiguration)
                                   .ConfigureAwait(false);

            var messageToSend = new MessageToSend
            {
                EncryptedProperty1 = "String 1",
                EncryptedProperty2 = "String 2"
            };
            await endpointInstance.SendLocal(messageToSend)
            .ConfigureAwait(false);

            ManualResetEvent.WaitOne();
        }
    public async Task SmokeTest(TransportTransactionMode transactionMode)
    {
        var endpointConfiguration = EndpointConfigBuilder.BuildEndpoint(nameof(SqlTransportIntegrationTests));
        var typesToScan           = TypeScanner.NestedTypes <SqlTransportIntegrationTests>();

        endpointConfiguration.SetTypesToScan(typesToScan);
        var transport = endpointConfiguration.UseTransport <SqlServerTransport>();

        transport.Transactions(transactionMode);
        transport.ConnectionString(MsSqlConnectionBuilder.ConnectionString);
        var persistence = endpointConfiguration.UsePersistence <SqlPersistence>();

        persistence.ConnectionBuilder(MsSqlConnectionBuilder.Build);
        persistence.DisableInstaller();
        persistence.SubscriptionSettings().DisableCache();

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

        var startSagaMessage = new StartSagaMessage
        {
            StartId = Guid.NewGuid()
        };
        await endpoint.SendLocal(startSagaMessage).ConfigureAwait(false);

        ManualResetEvent.WaitOne();
        await endpoint.Stop().ConfigureAwait(false);
    }
예제 #15
0
        public async Task Write()
        {
            var endpointConfiguration = new EndpointConfiguration(EndpointName);
            var typesToScan           = TypeScanner.NestedTypes <HeaderWriterDefer>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.SendFailedMessagesTo("error");
            endpointConfiguration.EnableInstallers();
            endpointConfiguration.UsePersistence <InMemoryPersistence>();
            endpointConfiguration.RegisterMessageMutator(new Mutator());
            var routing = endpointConfiguration.UseTransport <LearningTransport>().Routing();

            routing.RouteToEndpoint(GetType().Assembly, EndpointName);

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

            var options = new SendOptions();

            options.DelayDeliveryWith(TimeSpan.FromMilliseconds(10));
            await endpointInstance.Send(new MessageToSend(), options)
            .ConfigureAwait(false);

            ManualResetEvent.WaitOne();
            await endpointInstance.Stop()
            .ConfigureAwait(false);
        }
예제 #16
0
        public void Write()
        {
            BusConfiguration busConfiguration = new BusConfiguration();

            busConfiguration.EndpointName(endpointName);
            IEnumerable <Type> typesToScan = TypeScanner.NestedTypes <HeaderWriterError>(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.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();
            }
        }
        public async Task Write()
        {
            var endpointConfiguration = new EndpointConfiguration(endpointName);
            var dataBus = endpointConfiguration.UseDataBus <FileShareDataBus>();

            dataBus.BasePath(@"..\..\..\storage");
            var typesToScan = TypeScanner.NestedTypes <HeaderWriterDataBusProperty>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.SendFailedMessagesTo("error");
            endpointConfiguration.EnableInstallers();
            endpointConfiguration.UsePersistence <InMemoryPersistence>();
            endpointConfiguration.RegisterComponents(
                registration: components =>
            {
                components.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall);
            });

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

            var messageToSend = new MessageToSend
            {
                LargeProperty1 = new DataBusProperty <byte[]>(new byte[10]),
                LargeProperty2 = new DataBusProperty <byte[]>(new byte[10])
            };
            await endpointInstance.SendLocal(messageToSend)
            .ConfigureAwait(false);

            ManualResetEvent.WaitOne();
            await endpointInstance.Stop()
            .ConfigureAwait(false);
        }
        public void Write()
        {
            BusConfiguration busConfiguration = new BusConfiguration();

            busConfiguration.EndpointName(endpointName);
            var dataBus = busConfiguration.UseDataBus <FileShareDataBus>();

            dataBus.BasePath(@"..\..\..\storage");
            IEnumerable <Type> typesToScan = TypeScanner.NestedTypes <HeaderWriterDataBusConvention>(typeof(ConfigErrorQueue));

            busConfiguration.TypesToScan(typesToScan);
            busConfiguration.EnableInstallers();
            busConfiguration.Conventions().DefiningDataBusPropertiesAs(x => x.Name.StartsWith("LargeProperty"));
            busConfiguration.UsePersistence <InMemoryPersistence>();
            busConfiguration.RegisterComponents(c => c.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall));
            using (IBus bus = Bus.Create(busConfiguration).Start())
            {
                bus.SendLocal(new MessageToSend
                {
                    LargeProperty1 = new byte[10],
                    LargeProperty2 = new byte[10]
                });
                ManualResetEvent.WaitOne();
            }
        }
예제 #19
0
        IBus StartBus(State state)
        {
            BusConfiguration busConfiguration = new BusConfiguration();

            busConfiguration.RegisterComponents(c => c.ConfigureComponent(x => state, DependencyLifecycle.SingleInstance));
            busConfiguration.EndpointName(endpointName);
            busConfiguration.TypesToScan(TypeScanner.NestedTypes <ErrorQueueTests>());
            busConfiguration.EnableInstallers();
            busConfiguration.UsePersistence <InMemoryPersistence>();
            busConfiguration.DisableFeature <SecondLevelRetries>();
            return(Bus.Create(busConfiguration).Start());
        }
예제 #20
0
        IBus StartBus(State state)
        {
            BusConfiguration config = new BusConfiguration();

            config.RegisterComponents(c => c.ConfigureComponent(x => state, DependencyLifecycle.SingleInstance));
            config.EndpointName(endpointName);
            config.UseSerialization <JsonSerializer>();
            config.TypesToScan(TypeScanner.NestedTypes <NativeSendTests>());
            config.EnableInstallers();
            config.UsePersistence <InMemoryPersistence>();
            config.DisableFeature <SecondLevelRetries>();
            return(Bus.Create(config).Start());
        }
예제 #21
0
    async Task RunTest(Action <EndpointConfiguration> testCase)
    {
        manualResetEvent.Reset();
        string message = null;

        Execute(endpointName, OutboxScriptBuilder.BuildDropScript(BuildSqlVariant.MsSqlServer));
        Execute(endpointName, OutboxScriptBuilder.BuildCreateScript(BuildSqlVariant.MsSqlServer));
        Execute(createUserDataTableText);

        var endpointConfiguration = EndpointConfigBuilder.BuildEndpoint(endpointName);
        var typesToScan           = TypeScanner.NestedTypes <UserDataConsistencyTests>();

        endpointConfiguration.SetTypesToScan(typesToScan);
        endpointConfiguration.DisableFeature <NServiceBus.Features.TimeoutManager>();
        var transport = endpointConfiguration.UseTransport <SqlServerTransport>();

        testCase(endpointConfiguration);
        transport.ConnectionString(MsSqlConnectionBuilder.ConnectionString);
        var persistence = endpointConfiguration.UsePersistence <SqlPersistence>();

        persistence.ConnectionBuilder(MsSqlConnectionBuilder.Build);
        persistence.DisableInstaller();
        persistence.SubscriptionSettings().DisableCache();
        endpointConfiguration.DefineCriticalErrorAction(c =>
        {
            message = c.Error;
            manualResetEvent.Set();
            return(Task.FromResult(0));
        });
        endpointConfiguration.LimitMessageProcessingConcurrencyTo(1);
        endpointConfiguration.Pipeline.Register(new FailureTrigger(), "Failure trigger");

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

        var dataId = Guid.NewGuid();
        await endpoint.SendLocal(new FailingMessage
        {
            EntityId = dataId
        }).ConfigureAwait(false);

        await endpoint.SendLocal(new CheckMessage
        {
            EntityId = dataId
        }).ConfigureAwait(false);

        manualResetEvent.WaitOne();
        await endpoint.Stop().ConfigureAwait(false);

        Assert.AreEqual("Success", message);
    }
예제 #22
0
        IBus StartBus(State state)
        {
            BusConfiguration config = new BusConfiguration();

            config.RegisterComponents(c => c.ConfigureComponent(x => state, DependencyLifecycle.SingleInstance));
            config.EndpointName(endpointName);
            config.UseSerialization <JsonSerializer>();
            config.UseTransport <SqlServerTransport>().ConnectionString(connectionString);
            Type[] sqlTypes = typeof(SqlServerTransport).Assembly.GetTypes();
            config.TypesToScan(TypeScanner.NestedTypes <NativeSendTests>(sqlTypes));
            config.EnableInstallers();
            config.UsePersistence <InMemoryPersistence>();
            config.DisableFeature <SecondLevelRetries>();

            return(Bus.Create(config).Start());
        }
예제 #23
0
        public async Task Write()
        {
            EndpointConfiguration endpointConfiguration = new EndpointConfiguration(endpointName);
            IEnumerable <Type>    typesToScan           = TypeScanner.NestedTypes <HeaderWriterSaga>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.SendFailedMessagesTo("error");
            endpointConfiguration.EnableInstallers();
            endpointConfiguration.UsePersistence <InMemoryPersistence>();
            endpointConfiguration.RegisterComponents(c => c.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall));

            IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);

            await endpoint.SendLocal(new StartSaga1Message());

            CountdownEvent.Wait();
        }
예제 #24
0
        public void Write()
        {
            BusConfiguration busConfiguration = new BusConfiguration();

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

            busConfiguration.TypesToScan(typesToScan);
            busConfiguration.EnableInstallers();
            busConfiguration.UsePersistence <InMemoryPersistence>();
            busConfiguration.RegisterComponents(c => c.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall));
            using (IBus bus = Bus.Create(busConfiguration).Start())
            {
                bus.SendLocal(new MessageToSend());
                ManualResetEvent.WaitOne();
            }
        }
예제 #25
0
        public void Write()
        {
            BusConfiguration config = new BusConfiguration();

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

            config.TypesToScan(typesToScan);
            config.EnableInstallers();
            config.UsePersistence <InMemoryPersistence>();
            config.RegisterComponents(c => c.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall));
            using (var bus = (UnicastBus)Bus.Create(config).Start())
            {
                bus.SendLocal(new StartSaga1Message());
                CountdownEvent.Wait();
            }
        }
예제 #26
0
        IBus StartBus(State state)
        {
            var busConfiguration = new BusConfiguration();

            busConfiguration.RegisterComponents(
                registration: components =>
            {
                components.ConfigureComponent(x => state, DependencyLifecycle.SingleInstance);
            });
            busConfiguration.EndpointName(endpointName);
            busConfiguration.UseSerialization <JsonSerializer>();
            busConfiguration.TypesToScan(TypeScanner.NestedTypes <Tests>());
            busConfiguration.EnableInstallers();
            busConfiguration.UsePersistence <InMemoryPersistence>();
            busConfiguration.DisableFeature <SecondLevelRetries>();
            return(Bus.Create(busConfiguration).Start());
        }
예제 #27
0
        public async Task Write()
        {
            var endpointConfiguration = new EndpointConfiguration(endpointName);
            var typesToScan           = TypeScanner.NestedTypes <HeaderWriterSend>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.UseTransport(new LearningTransport());
            endpointConfiguration.RegisterMessageMutator(new Mutator());

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

            await endpointInstance.SendLocal(new MessageToSend())
            .ConfigureAwait(false);

            ManualResetEvent.WaitOne();
        }
        public void Write()
        {
            BusConfiguration config = new BusConfiguration();

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

            config.TypesToScan(typesToScan);
            config.EnableInstallers();
            config.UsePersistence <InMemoryPersistence>();
            config.RegisterComponents(c => c.ConfigureComponent <Mutator>(DependencyLifecycle.InstancePerCall));
            using (IBus bus = Bus.Create(config).Start())
            {
                bus.Defer(TimeSpan.FromMilliseconds(10), new MessageToSend());
                ManualResetEvent.WaitOne();
            }
        }
예제 #29
0
        IBus StartBus(State state)
        {
            LogManager.Use <DefaultFactory>()
            .Level(LogLevel.Warn);
            BusConfiguration config = new BusConfiguration();

            config.RegisterComponents(c => c.ConfigureComponent(x => state, DependencyLifecycle.SingleInstance));
            config.EndpointName(endpointName);
            config.UseSerialization <JsonSerializer>();
            config.UseTransport <RabbitMQTransport>()
            .ConnectionString("host=localhost");
            Type[] rabbitTypes = typeof(RabbitMQTransport).Assembly.GetTypes();
            config.TypesToScan(TypeScanner.NestedTypes <NativeSendTests>(rabbitTypes));
            config.EnableInstallers();
            config.UsePersistence <InMemoryPersistence>();
            config.DisableFeature <SecondLevelRetries>();
            return(Bus.Create(config).Start());
        }
예제 #30
0
        public async Task Write()
        {
            var endpointConfiguration = new EndpointConfiguration(endpointName);
            var typesToScan           = TypeScanner.NestedTypes <HeaderWriterSaga>();

            endpointConfiguration.SetTypesToScan(typesToScan);
            endpointConfiguration.UsePersistence <LearningPersistence>();
            endpointConfiguration.UseTransport(new LearningTransport());
            endpointConfiguration.RegisterMessageMutator(new Mutator());

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

            await endpointInstance.SendLocal(new StartSaga1Message { Guid = Guid.NewGuid() })
            .ConfigureAwait(false);

            CountdownEvent.Wait();
        }