protected void Init( ISqlTransactionalOutboxTableConfig outboxTableConfig, ISqlTransactionalOutboxItemFactory <TUniqueIdentifier, TPayload> outboxItemFactory, int distributedMutexAcquisitionTimeoutSeconds = Defaults.DistributedMutexAcquisitionTimeoutSeconds ) { //Possible Dependencies OutboxTableConfig = outboxTableConfig.AssertNotNull(nameof(outboxTableConfig)); OutboxItemFactory = outboxItemFactory.AssertNotNull(nameof(outboxItemFactory)); //Default Known setup for Sql Server... QueryBuilder = new SqlServerTransactionalOutboxQueryBuilder <TUniqueIdentifier>(outboxTableConfig); DistributedMutexLockName = $"SqlServerTransactionalOutboxProcessor::{QueryBuilder.BuildTableName()}"; DistributedMutexAcquisitionTimeoutSeconds = distributedMutexAcquisitionTimeoutSeconds; }
public SqlServerOutboxRepository( SqlTransaction sqlTransaction, ISqlTransactionalOutboxTableConfig outboxTableConfig = null, ISqlTransactionalOutboxItemFactory <TUniqueIdentifier, TPayload> outboxItemFactory = null, int distributedMutexAcquisitionTimeoutSeconds = Defaults.DistributedMutexAcquisitionTimeoutSeconds ) { SqlTransaction = sqlTransaction ?? throw new ArgumentNullException(nameof(sqlTransaction), "A valid SqlTransaction must be provided for Sql Transactional Outbox processing."); SqlConnection = sqlTransaction.Connection ?? throw new ArgumentNullException(nameof(SqlConnection), "The SqlTransaction specified must have a valid SqlConnection."); base.Init( outboxTableConfig: outboxTableConfig.AssertNotNull(nameof(outboxTableConfig)), outboxItemFactory: outboxItemFactory.AssertNotNull(nameof(outboxItemFactory)), distributedMutexAcquisitionTimeoutSeconds ); }