예제 #1
0
 public PublishReflex(MqttClientConfiguration mqttConfiguration, IIncomingPacketStore store, Func <IActivityMonitor, string, PipeReader, int, QualityOfService, bool, CancellationToken, ValueTask> messageHandler, OutputPump output)
 {
     _mqttConfiguration = mqttConfiguration;
     _store             = store;
     _messageHandler    = messageHandler;
     _output            = output;
 }
예제 #2
0
 /// <summary>
 /// Instantiate the <see cref="MqttClientImpl"/> with the given configuration.
 /// </summary>
 /// <param name="config">The configuration to use.</param>
 /// <param name="messageHandler">The delegate that will handle incoming messages. <see cref="MessageHandlerDelegate"/> docs for more info.</param>
 internal MqttClientImpl(ProtocolConfiguration protocolConfig, MqttClientConfiguration config, Func <IActivityMonitor, string, PipeReader, int, QualityOfService, bool, CancellationToken, ValueTask> messageHandler)
     : base(config)
 {
     (_pConfig, _config, _messageHandler) = (protocolConfig, config, messageHandler);
     if (config.WaitTimeoutMilliseconds > config.KeepAliveSeconds && config.KeepAliveSeconds != 0)
     {
         throw new ArgumentException("Wait timeout should be smaller than the keep alive.");
     }
 }
예제 #3
0
 public static IMqttClient CreateMQTTClient(this MqttClientFactory?factory, MqttClientConfiguration config, Func <IActivityMonitor, DisposableApplicationMessage, ValueTask> messageHandler)
 => factory.CreateMQTTClient(config, new HandlerClosure(messageHandler).HandleMessage);
예제 #4
0
 public static IMqttClient CreateMQTTClient(this MqttClientFactory?factory, MqttClientConfiguration config, Func <IActivityMonitor, string, PipeReader, int, QualityOfService, bool, CancellationToken, ValueTask> messageHandler)
 => new MqttClientImpl(ProtocolConfiguration.Mqtt5, config, messageHandler);