Exemplo n.º 1
0
        public void CanCreateSagaTablesAutomatically()
        {
            storage.EnsureTableIsCreated();

            var existingTables = GetTableNames();

            existingTables.ShouldContain(SubscriptionsTableName);
        }
        protected override void DoSetUp()
        {
            DropTable(SubscriptionsTableName);

            storage = new PostgreSqlSubscriptionStorage(GetOrCreateConnection, SubscriptionsTableName);
            storage.EnsureTableIsCreated();
        }
Exemplo n.º 3
0
        public ISubscriptionStorage Create()
        {
            var subscriptionStorage = new PostgreSqlSubscriptionStorage(PostgreSqlTestHelper.ConnectionHelper, "subscriptions", true, new ConsoleLoggerFactory(false));

            subscriptionStorage.EnsureTableIsCreated();
            return(subscriptionStorage);
        }
        /// <summary>
        /// Configures Rebus to use PostgreSQL to store subscriptions. Use <paramref name="isCentralized"/> = true to indicate whether it's OK to short-circuit
        /// subscribing and unsubscribing by manipulating the subscription directly from the subscriber or just let it default to false to preserve the
        /// default behavior.
        /// </summary>
        public static void StoreInPostgres(this StandardConfigurer <ISubscriptionStorage> configurer, IPostgresConnectionProvider connectionProvider, string tableName, bool isCentralized = false, bool automaticallyCreateTables = true)
        {
            configurer.Register(c =>
            {
                var rebusLoggerFactory  = c.Get <IRebusLoggerFactory>();
                var subscriptionStorage = new PostgreSqlSubscriptionStorage(connectionProvider, tableName, isCentralized, rebusLoggerFactory);

                if (automaticallyCreateTables)
                {
                    subscriptionStorage.EnsureTableIsCreated();
                }

                return(subscriptionStorage);
            });
        }
        /// <summary>
        /// Configures Rebus to use PostgreSQL to store subscriptions. Use <see cref="isCentralized"/> = true to indicate whether it's OK to short-circuit
        /// subscribing and unsubscribing by manipulating the subscription directly from the subscriber or just let it default to false to preserve the
        /// default behavior.
        /// </summary>
        public static void StoreInPostgres(this StandardConfigurer<ISubscriptionStorage> configurer,
            string connectionString, string tableName, bool isCentralized = false, bool automaticallyCreateTables = true)
        {
            configurer.Register(c =>
            {
                var subscriptionStorage = new PostgreSqlSubscriptionStorage(
                    new PostgresConnectionHelper(connectionString), tableName, isCentralized);

                if (automaticallyCreateTables)
                {
                    subscriptionStorage.EnsureTableIsCreated();
                }

                return subscriptionStorage;
            });
        }