示例#1
0
        public DeadLetterQueueConsumer(IDeadLetterStore deadLetterStore, DeadLetterReprocessorOptions options)
        {
            if (string.IsNullOrWhiteSpace(options.DeadLetterConsumerOptions.QueueName))
            {
                throw new ArgumentException("DeadLetterQueueName");
            }

            if (options.MaxRetryLimit < 1)
            {
                throw new ArgumentException("MaxRetryLimit");
            }

            if (options.DefaultRetryAfter < 1)
            {
                throw new ArgumentException("DefaultRetryAfter");
            }

            _deadLetterStore     = deadLetterStore;
            _deadLetterQueueName = options.DeadLetterConsumerOptions.QueueName;
            _maxRetryLimit       = options.MaxRetryLimit;
            _defaultRetryAfter   = TimeSpan.FromMinutes(options.DefaultRetryAfter);

            //TODO
            //StartStorageTask(TimeSpan.FromMinutes(options.DefaultRetryAfter));
        }
示例#2
0
        public DeadLetterRepublisher(IDeadLetterStore deadLetterStore, IModel model)
        {
            _deadLetterStore = deadLetterStore;

            _model = model;
            _model.ConfirmSelect();

            _props = _model.CreateBasicProperties();
            _props.ContentEncoding = "UTF-8";
            _props.ContentType     = "application/json";
            _props.Persistent      = true;
            _props.Headers         = new Dictionary <string, object>();

            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            _model = model;
            _model.ConfirmSelect();

            //TODO Add this to RabbitOptions & implement in RabbitAdapter
            _confirmTimeout = TimeSpan.FromMilliseconds(5000);
        }