protected override void DoSetUp() { DropTable(SubscriptionsTableName); storage = new PostgreSqlSubscriptionStorage(GetOrCreateConnection, SubscriptionsTableName); storage.EnsureTableIsCreated(); }
/// <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 rebusLoggerFactory = c.Get <IRebusLoggerFactory>(); var connectionHelper = new PostgresConnectionHelper(connectionString); var subscriptionStorage = new PostgreSqlSubscriptionStorage( connectionHelper, tableName, isCentralized, rebusLoggerFactory); if (automaticallyCreateTables) { subscriptionStorage.EnsureTableIsCreated(); } return(subscriptionStorage); }); }
/// <summary> /// Checks to see if the underlying SQL tables are created - if none of them exist, /// they will automatically be created /// </summary> public PostgreSqlSubscriptionStorageFluentConfigurer EnsureTableIsCreated() { postgreSqlSubscriptionStorage.EnsureTableIsCreated(); return(this); }