public SqlServerSnapshotStore(Config config) : base(config)
        {
            var sqlConfig = config.WithFallback(Extension.DefaultSnapshotConfig);

            QueryExecutor = new SqlServerQueryExecutor(new QueryConfiguration(
                                                           schemaName: config.GetString("schema-name"),
                                                           snapshotTableName: config.GetString("table-name"),
                                                           persistenceIdColumnName: "PersistenceId",
                                                           sequenceNrColumnName: "SequenceNr",
                                                           payloadColumnName: "Snapshot",
                                                           manifestColumnName: "Manifest",
                                                           timestampColumnName: "Timestamp",
                                                           timeout: sqlConfig.GetTimeSpan("connection-timeout")),
                                                       Context.System.Serialization);
        }
        public SqlServerSnapshotStore(Config snapshotConfig) : base(snapshotConfig)
        {
            var config = snapshotConfig.WithFallback(Extension.DefaultSnapshotConfig);

            QueryExecutor = new SqlServerQueryExecutor(new QueryConfiguration(

                                                           schemaName: config.GetString("schema-name", null),
                                                           snapshotTableName: config.GetString("table-name", null),
                                                           persistenceIdColumnName: "PersistenceId",
                                                           sequenceNrColumnName: "SequenceNr",
                                                           payloadColumnName: "Snapshot",
                                                           manifestColumnName: "Manifest",
                                                           timestampColumnName: "Timestamp",
                                                           serializerIdColumnName: "SerializerId",
                                                           timeout: config.GetTimeSpan("connection-timeout", null),
                                                           defaultSerializer: config.GetString("serializer", null),
                                                           useSequentialAccess: config.GetBoolean("sequential-access", false)),
                                                       Context.System.Serialization);
        }
Exemple #3
0
        public SqlServerSnapshotStore(Config snapshotConfig) : base(snapshotConfig)
        {
            var config = snapshotConfig.WithFallback(Extension.DefaultSnapshotConfig);
            var connectionTimeoutSeconds =
                new SqlConnectionStringBuilder(
                    config.GetString("connection-string")).ConnectTimeout;
            var commandTimeout        = config.GetTimeSpan("connection-timeout", null);
            var circuitBreakerTimeout = snapshotConfig.GetTimeSpan(
                "circuit-breaker.call-timeout",
                null);
            var totalTimeout = commandTimeout.Add(
                TimeSpan.FromSeconds(connectionTimeoutSeconds));

            if (totalTimeout >=
                circuitBreakerTimeout)
            {
                Log.Warning(
                    "Configured Total of Connection timeout ({0} seconds) and Command timeout ({1} seconds) is less than or equal to Circuit breaker timeout ({2} seconds). This may cause unintended write failures",
                    connectionTimeoutSeconds, commandTimeout.TotalSeconds,
                    circuitBreakerTimeout.TotalSeconds);
            }
            QueryExecutor = new SqlServerQueryExecutor(new QueryConfiguration(

                                                           schemaName: config.GetString("schema-name", null),
                                                           snapshotTableName: config.GetString("table-name", null),
                                                           persistenceIdColumnName: "PersistenceId",
                                                           sequenceNrColumnName: "SequenceNr",
                                                           payloadColumnName: "Snapshot",
                                                           manifestColumnName: "Manifest",
                                                           timestampColumnName: "Timestamp",
                                                           serializerIdColumnName: "SerializerId",
                                                           timeout: config.GetTimeSpan("connection-timeout", null),
                                                           defaultSerializer: config.GetString("serializer", null),
                                                           useSequentialAccess: config.GetBoolean("sequential-access", false)),
                                                       Context.System.Serialization);
        }