public void Specific_stores_should_mask_default()
        {
            using (var db = new ReusableDB())
            {
                var settings = new SettingsHolder();
                settings.Set("Transactions.SuppressDistributedTransactions", true);
                settings.Set("TypesToScan", new Type[0]);
                settings.Set("NServiceBus.Routing.EndpointName", "FakeEndpoint");
                settings.Set("NServiceBus.Transport.TransportInfrastructure", new FakeRavenDBTransportInfrastructure(TransportTransactionMode.None));
                settings.Set("Endpoint.SendOnly", true);

                DocumentStoreManager.SetDocumentStore <StorageType.GatewayDeduplication>(settings, db.NewStore("GatewayDeduplication"));
                DocumentStoreManager.SetDocumentStore <StorageType.Outbox>(settings, db.NewStore("Outbox"));
                DocumentStoreManager.SetDocumentStore <StorageType.Sagas>(settings, db.NewStore("Sagas"));
                DocumentStoreManager.SetDocumentStore <StorageType.Subscriptions>(settings, db.NewStore("Subscriptions"));
                DocumentStoreManager.SetDocumentStore <StorageType.Timeouts>(settings, db.NewStore("Timeouts"));
                DocumentStoreManager.SetDefaultStore(settings, db.NewStore("Default"));

                var readOnly = settings as ReadOnlySettings;

                Assert.AreEqual("GatewayDeduplication", DocumentStoreManager.GetDocumentStore <StorageType.GatewayDeduplication>(readOnly).Identifier);
                Assert.AreEqual("Outbox", DocumentStoreManager.GetDocumentStore <StorageType.Outbox>(readOnly).Identifier);
                Assert.AreEqual("Sagas", DocumentStoreManager.GetDocumentStore <StorageType.Sagas>(readOnly).Identifier);
                Assert.AreEqual("Subscriptions", DocumentStoreManager.GetDocumentStore <StorageType.Subscriptions>(readOnly).Identifier);
                Assert.AreEqual("Timeouts", DocumentStoreManager.GetDocumentStore <StorageType.Timeouts>(readOnly).Identifier);
            }
        }
        protected override void Setup(FeatureConfigurationContext context)
        {
            var store = DocumentStoreManager.GetDocumentStore <StorageType.Timeouts>(context.Settings);

            context.Container.ConfigureComponent(() => new TimeoutPersister(store), DependencyLifecycle.InstancePerCall);
            context.Container.ConfigureComponent(() => new QueryTimeouts(store, context.Settings.EndpointName()), DependencyLifecycle.SingleInstance);  // Needs to be SingleInstance because it contains cleanup state

            context.Container.ConfigureComponent <QueryCanceller>(DependencyLifecycle.InstancePerCall);
            context.RegisterStartupTask(b => b.Build <QueryCanceller>());
        }
Esempio n. 3
0
        protected override void Setup(FeatureConfigurationContext context)
        {
            var store = DocumentStoreManager.GetDocumentStore <StorageType.Outbox>(context.Settings);

            context.Container.ConfigureComponent(b => new OutboxPersister(store, context.Settings.EndpointName()), DependencyLifecycle.InstancePerCall);

            context.Container.ConfigureComponent(b => new OutboxRecordsCleaner(store), DependencyLifecycle.InstancePerCall);

            context.Container.ConfigureComponent <OutboxCleaner>(DependencyLifecycle.InstancePerCall);

            context.RegisterStartupTask(builder => builder.Build <OutboxCleaner>());
        }
Esempio n. 4
0
        public void Should_set_specific_document_store()
        {
            var settings = new SettingsHolder();

            DocumentStoreManager.SetDocumentStore <StorageType.Sagas>(settings, FakeStore("Sagas"));
            DocumentStoreManager.SetDocumentStore <StorageType.Timeouts>(settings, FakeStore("Timeouts"));
            DocumentStoreManager.SetDefaultStore(settings, FakeStore("Default"));
            var readOnly = settings as ReadOnlySettings;

            Assert.AreEqual(_fakeStores["Sagas"], DocumentStoreManager.GetDocumentStore <StorageType.Sagas>(readOnly));
            Assert.AreEqual(_fakeStores["Timeouts"], DocumentStoreManager.GetDocumentStore <StorageType.Timeouts>(readOnly));
        }
Esempio n. 5
0
        protected override void Setup(FeatureConfigurationContext context)
        {
            context.Container.ConfigureComponent <MartenSynchronizedStorageAdapter>(DependencyLifecycle.SingleInstance);
            context.Container.ConfigureComponent <MartenSynchronizedStorage>(DependencyLifecycle.SingleInstance);

            IDocumentStore store = DocumentStoreManager.GetDocumentStore <StorageType.Sagas>(context.Settings);

            //Todo: Add Provided Session Behavior?

            //Todo: make sure this behavior is executed AFTER correct step in pipeline...
            context.Pipeline.Register("OpenMartenSession", new OpenSessionBehavior(store), "Makes sure that there is a Marten IDocumentSession available on the pipeline");
        }
Esempio n. 6
0
        public void Specific_stores_should_mask_default()
        {
            using (var db = new ReusableDB())
            {
                var cfg = new EndpointConfiguration("FakeEndpoint");
                cfg.UseTransport(new LearningTransport());
                cfg.SendOnly();

                var persistence = cfg.UsePersistence <RavenDBPersistence>();
                var settings    = persistence.GetSettings();

                DocumentStoreManager.SetDocumentStore <StorageType.Outbox>(settings, db.NewStore("Outbox"));
                DocumentStoreManager.SetDocumentStore <StorageType.Sagas>(settings, db.NewStore("Sagas"));
                DocumentStoreManager.SetDocumentStore <StorageType.Subscriptions>(settings, db.NewStore("Subscriptions"));
                DocumentStoreManager.SetDefaultStore(settings, db.NewStore("Default"));

                var readOnly = settings as ReadOnlySettings;

                Assert.AreEqual("Outbox", DocumentStoreManager.GetDocumentStore <StorageType.Outbox>(readOnly, null).Identifier);
                Assert.AreEqual("Sagas", DocumentStoreManager.GetDocumentStore <StorageType.Sagas>(readOnly, null).Identifier);
                Assert.AreEqual("Subscriptions", DocumentStoreManager.GetDocumentStore <StorageType.Subscriptions>(readOnly, null).Identifier);
            }
        }