protected override void Setup(FeatureConfigurationContext context)
    {
        var settings = context.Settings;

        settings.EnableFeature <StorageType.Subscriptions>();

        var connectionBuilder = settings.GetConnectionBuilder();
        var tablePrefix       = settings.GetTablePrefix();
        var sqlVariant        = settings.GetSqlVariant();
        var schema            = settings.GetSchema();
        var cacheFor          = SubscriptionSettings.GetCacheFor(settings);
        var persister         = new SubscriptionPersister(connectionBuilder, tablePrefix, sqlVariant, schema, cacheFor);

        ConfigValidation.ValidateTableSettings(sqlVariant, tablePrefix, schema);

        context.Container.RegisterSingleton(typeof(ISubscriptionStorage), persister);
    }
    protected override void Setup(FeatureConfigurationContext context)
    {
        var settings = context.Settings;

        settings.EnableFeature <StorageType.Timeouts>();
        var sqlVariant        = settings.GetSqlVariant();
        var connectionBuilder = settings.GetConnectionBuilder();
        var tablePrefix       = settings.GetTablePrefix();
        var schema            = settings.GetSchema();
        var timeoutsCleanupExecutionInterval = context.Settings.GetOrDefault <TimeSpan?>("SqlPersistence.Timeout.CleanupExecutionInterval") ?? TimeSpan.FromMinutes(2);

        ConfigValidation.ValidateTableSettings(sqlVariant, tablePrefix, schema);

        var persister = new TimeoutPersister(connectionBuilder, tablePrefix, sqlVariant, schema, timeoutsCleanupExecutionInterval);

        context.Container.RegisterSingleton(typeof(IPersistTimeouts), persister);
        context.Container.RegisterSingleton(typeof(IQueryTimeouts), persister);
    }
Exemplo n.º 3
0
    public async Task Install(string identity)
    {
        var connectionBuilder = settings.GetConnectionBuilder();
        var sqlVariant        = settings.GetSqlVariant();
        var schema            = settings.GetSchema();
        var scriptDirectory   = ScriptLocation.FindScriptDirectory(sqlVariant);
        var tablePrefix       = settings.GetTablePrefix();

        ConfigValidation.ValidateTableSettings(sqlVariant, tablePrefix, schema);

        using (var connection = await connectionBuilder.OpenConnection().ConfigureAwait(false))
            using (var transaction = connection.BeginTransaction())
            {
                await InstallOutbox(scriptDirectory, connection, transaction, tablePrefix, schema, sqlVariant).ConfigureAwait(false);
                await InstallSagas(scriptDirectory, connection, transaction, tablePrefix, schema, sqlVariant).ConfigureAwait(false);
                await InstallSubscriptions(scriptDirectory, connection, transaction, tablePrefix, schema, sqlVariant).ConfigureAwait(false);
                await InstallTimeouts(scriptDirectory, connection, transaction, tablePrefix, schema, sqlVariant).ConfigureAwait(false);

                transaction.Commit();
            }
    }