public SQLSubscriptionTrackingService(ConnectionStringSettings connectionStringSettings,
     ISQLDialect dialect = null)
 {
     if (connectionStringSettings == null) throw new ArgumentNullException("connectionStringSettings");
     _connectionProvider = new DefaultConnectionProvider(connectionStringSettings);
     _dialect = dialect ?? connectionStringSettings.GetSQLDialect();
 }
 public SQLSubscriptionTrackingService(IDbConnectionProvider connectionProvider, ISQLDialect dialect)
 {
     if (connectionProvider == null) throw new ArgumentNullException("connectionProvider");
     if (dialect == null) throw new ArgumentNullException("dialect");
     _connectionProvider = connectionProvider;
     _dialect = dialect;
 }
Exemple #3
0
        public SQLMessageQueue(IDbConnectionProvider connectionProvider, ISQLDialect dialect, QueueName queueName,
            IQueueListener listener, QueueOptions options = default(QueueOptions))
        {
            if (connectionProvider == null) throw new ArgumentNullException("connectionProvider");
            if (dialect == null) throw new ArgumentNullException("dialect");
            if (queueName == null) throw new ArgumentNullException("queueName");
            if (listener == null) throw new ArgumentNullException("listener");

            _connectionProvider = connectionProvider;
            _dialect = dialect;
            _queueName = queueName;

            _listener = listener;
            _autoAcknowledge = options.AutoAcknowledge;
            _maxAttempts = options.MaxAttempts <= 0 ? 10 : options.MaxAttempts;
            _retryDelay = options.RetryDelay < TimeSpan.Zero ? TimeSpan.Zero : options.RetryDelay;

            var concurrencyLimit = options.ConcurrencyLimit <= 0
                ? QueueOptions.DefaultConcurrencyLimit
                : options.ConcurrencyLimit;
            _concurrentMessageProcessingSlot = new SemaphoreSlim(concurrencyLimit);

            _cancellationTokenSource = new CancellationTokenSource();
            _queuedMessages = new BufferBlock<SQLQueuedMessage>(new DataflowBlockOptions
            {
                CancellationToken = _cancellationTokenSource.Token
            });
        }