示例#1
0
 public MqttClientSubscriptionsManager(
     MqttClientSession clientSession,
     IMqttServerOptions serverOptions,
     MqttServerEventDispatcher eventDispatcher,
     IMqttRetainedMessagesManager retainedMessagesManager)
 {
     _clientSession           = clientSession ?? throw new ArgumentNullException(nameof(clientSession));
     _options                 = serverOptions ?? throw new ArgumentNullException(nameof(serverOptions));
     _eventDispatcher         = eventDispatcher ?? throw new ArgumentNullException(nameof(eventDispatcher));
     _retainedMessagesManager = retainedMessagesManager ?? throw new ArgumentNullException(nameof(retainedMessagesManager));
 }
 MqttClientConnection CreateConnection(MqttConnectPacket connectPacket, IMqttChannelAdapter channelAdapter,
                                       MqttClientSession session)
 {
     return(new MqttClientConnection(
                connectPacket,
                channelAdapter,
                session,
                _options,
                this,
                _rootLogger));
 }
示例#3
0
        public MqttClientConnection(
            MqttConnectPacket connectPacket,
            IMqttChannelAdapter channelAdapter,
            MqttClientSession session,
            IMqttServerOptions serverOptions,
            MqttClientSessionsManager sessionsManager,
            IMqttNetLogger logger)
        {
            _serverOptions   = serverOptions ?? throw new ArgumentNullException(nameof(serverOptions));
            _sessionsManager = sessionsManager ?? throw new ArgumentNullException(nameof(sessionsManager));

            _channelAdapter = channelAdapter ?? throw new ArgumentNullException(nameof(channelAdapter));
            _endpoint       = channelAdapter.Endpoint;

            Session        = session ?? throw new ArgumentNullException(nameof(session));
            _connectPacket = connectPacket ?? throw new ArgumentNullException(nameof(connectPacket));

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            _logger = logger.WithSource(nameof(MqttClientConnection));
        }