Пример #1
0
        public MqttClientSession(
            string clientId,
            IOptions <MqttServerOptions> options,
            MqttClientSessionsManager sessionsManager,
            MqttClientSubscriptionsManager subscriptionsManager,
            ILogger <MqttClientSession> logger,
            ILogger <MqttClientPendingMessagesQueue> messageQueueLogger)
        {
            _sessionsManager      = sessionsManager ?? throw new ArgumentNullException(nameof(sessionsManager));
            _subscriptionsManager = subscriptionsManager ?? throw new ArgumentNullException(nameof(subscriptionsManager));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            ClientId = clientId;

            _options = options.Value;
            _pendingMessagesQueue = new MqttClientPendingMessagesQueue(_options, this, messageQueueLogger);
        }
Пример #2
0
        public MqttServer(
            IOptions <MqttServerOptions> options,
            IEnumerable <IMqttServerAdapter> adapters,
            ILogger <MqttServer> logger,
            MqttClientSessionsManager clientSessionsManager,
            IMqttClientRetainedMessageManager clientRetainedMessageManager)
        {
            _options = options.Value ?? throw new ArgumentNullException(nameof(options));
            _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
            _clientSessionsManager        = clientSessionsManager ?? throw new ArgumentNullException(nameof(clientSessionsManager));
            _clientRetainedMessageManager = clientRetainedMessageManager ?? throw new ArgumentNullException(nameof(clientRetainedMessageManager));

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

            _adapters = adapters.ToList();

            _clientSessionsManager.ApplicationMessageReceived += (s, e) => ApplicationMessageReceived?.Invoke(s, e);
            _clientSessionsManager.ClientConnected            += OnClientConnected;
            _clientSessionsManager.ClientDisconnected         += OnClientDisconnected;
        }
Пример #3
0
 public MqttClientSessionsManager(MqttServerOptions options)
 {
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }
Пример #4
0
 public MqttClientSubscriptionsManager(IOptions <MqttServerOptions> options)
 {
     _options = options?.Value ?? throw new ArgumentNullException(nameof(options));
 }
 public MqttClientSessionsManager(MqttServerOptions options)
 {
     _options = options ?? throw new ArgumentNullException(nameof(options));
     RetainedMessagesManager = new MqttClientRetainedMessagesManager(options);
 }
Пример #6
0
 public MqttClientPendingMessagesQueue(MqttServerOptions options, MqttClientSession session, ILogger <MqttClientPendingMessagesQueue> logger)
 {
     _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
     _session = session ?? throw new ArgumentNullException(nameof(session));
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }
Пример #7
0
 public MqttClientMessageQueue(MqttServerOptions options)
 {
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }
 public MqttClientRetainedMessagesManager(IOptions <MqttServerOptions> options, ILogger <MqttClientRetainedMessagesManager> logger)
 {
     _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
     _options = options.Value ?? throw new ArgumentNullException(nameof(options));
 }
Пример #9
0
 public MqttClientSessionsManager(MqttServerOptions options, MqttRetainedMessagesManager retainedMessagesManager, IMqttNetLogger logger)
 {
     _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
     _options = options ?? throw new ArgumentNullException(nameof(options));
     _retainedMessagesManager = retainedMessagesManager ?? throw new ArgumentNullException(nameof(retainedMessagesManager));
 }