public DeviceService(IQueueConnectionFactory queueConnectionFactory, IDataRead dataread, DomotiqueContext context, ILogger <DeviceService> logger)
 {
     _queueConnectionFactory = queueConnectionFactory;
     _dataread = dataread;
     _context  = context;
     _logger   = logger;
 }
Exemple #2
0
        public QueueConsumer(IQueueConfiguration queueConfiguration,
                             IQueueConnectionFactory connectionFactory,
                             IJsonSerializer serializer,
                             IValidationHelper validationHelper,
                             string consumerName)
        {
            _queueConfiguration = queueConfiguration ?? throw new ArgumentNullException(nameof(queueConfiguration));
            _connectionFactory  = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));
            _serializer         = serializer ?? throw new ArgumentNullException(nameof(serializer));
            _validationHelper   = validationHelper ?? throw new ArgumentNullException(nameof(validationHelper));

            if (string.IsNullOrEmpty(consumerName))
            {
                throw new ArgumentNullException(nameof(consumerName));
            }

            _consumerName = consumerName;

            // verify that the queue configuration is valid
            if (!queueConfiguration.IsValid)
            {
                throw new ArgumentException("Queue Configuration is not valid", nameof(queueConfiguration));
            }

            // retrieve the specific queues configuration
            _consumerConfig = queueConfiguration.Consumers?.FirstOrDefault(c => c.Name == _consumerName);

            if (_consumerConfig == null)
            {
                throw new ArgumentNullException(nameof(_consumerConfig));
            }

            this._performanceLoggingMethodName = $"{consumerName}.Run";
        }
Exemple #3
0
        public QueuePublisher(IQueueConfiguration queueConfiguration,
                              IQueueConnectionFactory connectionFactory,
                              IJsonSerializer serializer,
                              string publisherName,
                              CancellationToken cancellationToken)
        {
            if (queueConfiguration == null)
            {
                throw new ArgumentNullException(nameof(queueConfiguration));
            }

            if (cancellationToken == null)
            {
                throw new ArgumentNullException(nameof(cancellationToken));
            }

            _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));
            _publisherName     = publisherName ?? throw new ArgumentNullException(nameof(publisherName));
            _serializer        = serializer ?? throw new ArgumentNullException(nameof(serializer));
            _cancellationToken = cancellationToken;

            // retrieve the specific queues configuration
            _publisherConfig = queueConfiguration.Publishers?.FirstOrDefault(c => c.Name == _publisherName);

            if (_publisherConfig == null)
            {
                throw new ArgumentNullException(nameof(_publisherConfig));
            }
        }
Exemple #4
0
        public QueuePublisher(IQueueConfiguration queueConfiguration,
                              IQueueConnectionFactory connectionFactory,
                              IJsonSerializer serializer,
                              IValidationHelper validationHelper,
                              string publisherName,
                              CancellationToken cancellationToken)
        {
            if (queueConfiguration == null)
            {
                throw new ArgumentNullException(nameof(queueConfiguration));
            }

            _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));
            _publisherName     = publisherName ?? throw new ArgumentNullException(nameof(publisherName));
            _serializer        = serializer ?? throw new ArgumentNullException(nameof(serializer));
            _validationHelper  = validationHelper ?? throw new ArgumentNullException(nameof(validationHelper));
            _cancellationToken = cancellationToken;

            // verify that the queue configuration is valid
            if (!queueConfiguration.IsValid)
            {
                throw new ArgumentException("Queue Configuration is not valid", nameof(queueConfiguration));
            }

            // retrieve the specific queues configuration
            _publisherConfig = queueConfiguration.Publishers?.FirstOrDefault(c => c.Name == _publisherName);

            if (_publisherConfig == null)
            {
                throw new ArgumentNullException(nameof(_publisherConfig));
            }
        }
Exemple #5
0
        public QueueConsumer(IQueueConfiguration queueConfiguration,
                             IQueueConnectionFactory connectionFactory,
                             IJsonSerializer serializer,
                             string consumerName,
                             CancellationToken cancellationToken)
        {
            _queueConfiguration = queueConfiguration ?? throw new ArgumentNullException(nameof(queueConfiguration));
            _connectionFactory  = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));
            _consumerName       = consumerName ?? throw new ArgumentNullException(nameof(consumerName));
            _serializer         = serializer ?? throw new ArgumentNullException(nameof(serializer));

            if (cancellationToken == null)
            {
                throw new ArgumentNullException(nameof(cancellationToken));
            }

            _cancellationToken = cancellationToken;

            // retrieve the specific queues configuration
            _queueConfig = queueConfiguration.Publishers.Cast <QueueConfig>().Where(p => p.Name == _consumerName).FirstOrDefault() as IQueueConfig;

            if (_queueConfig == null)
            {
                throw new ArgumentNullException(nameof(_queueConfig));
            }
        }
 public DeviceStatusReadingService(IQueueConnectionFactory queueConnectionFactory, ILogService logService, IDataRead dataRead, IDBContextProvider contextProvider, ILogger <DeviceStatusReadingService> logger, IHubContext <NotificationHub> context)
 {
     _queueConnectionFactory = queueConnectionFactory;
     _logService             = logService;
     _logger          = logger;
     _contextProvider = contextProvider;
     _contextt        = context;
 }
Exemple #7
0
 public TemperatureReadingService(IDataRead dataRead, IQueueConnectionFactory queueConnectionFactory, IDBContextProvider provider, ILogger <TemperatureReadingService> logger, IHubContext <NotificationHub> context)
 {
     _dataRead = dataRead;
     _provider = provider;
     _queueConnectionFactory = queueConnectionFactory;
     _logger          = logger;
     _notificationHub = context;
 }
 protected BaseAsyncRabbitMqConsumer(IQueueConnectionFactory connectionFactory, ILogger <TSelf> logger,
                                     ConsumerQueuesList consumerQueuesList, IMediator mediator)
 {
     Logger             = logger;
     Mediator           = mediator;
     Model              = connectionFactory.CreateConnection(true).CreateModel();
     Consumer           = new AsyncEventingBasicConsumer(Model);
     Consumer.Received += ConsumerOnReceived;
     // ReSharper disable once VirtualMemberCallInConstructor
     QueueName = consumerQueuesList[ConsumerHandlerType];
 }
 public QueueProcessor(IQueueConnectionFactory factory)
 {
     _factory = factory;
     Channels = new Dictionary <string, IModel>();
 }
 public IncomingLetterQueue(IQueueConnectionFactory connectionFactory)
 {
     _connectionFactory = connectionFactory;
 }
Exemple #11
0
 public void SetConnectionFactory(IQueueConnectionFactory connectionFactory)
 {
     _model      = connectionFactory.CreateConnection().CreateModel();
     _properties = _model.CreateBasicProperties();
 }
 public AsyncEmailConsumer(IQueueConnectionFactory connectionFactory, ConsumerQueuesList consumerQueueList,
                           ILogger <AsyncEmailConsumer> logger, IMediator mediator) : base(connectionFactory, logger, consumerQueueList,
                                                                                           mediator)
 {
 }
Exemple #13
0
 internal RabbitMqPublisherBuilder <TPublisher> WithConnectionFactory(IQueueConnectionFactory connectionFactory)
 {
     _connectionFactory = connectionFactory;
     return(this);
 }