/// <summary> /// Initialises an instance of the <see cref="MqttMessagePublisher"/> class. /// </summary> /// <param name="connection"> /// The AMQP connection to use. /// </param> /// <param name="topicName"> /// The topic name to publish to. /// </param> /// <param name="name"> /// The unique name to associate with the link used to send messages on. /// </param> /// <param name="handler"> ///Processes incoming messages from the MQTT broker. /// </param> public MqttMessageSubscriber(MqttConnection connection, string topicName, string name, IMessageHandler handler) { connection.ShouldNotBeNull(); topicName.ShouldNotBeEmpty(); name.ShouldNotBeEmpty(); m_ConnectionId = string.Empty; m_Connection = connection; m_TopicName = topicName; m_Name = name; m_MessageHandler = handler; }
/// <summary> /// Initialises an instance of the <see cref="MqttMessagePublisher"/> class. /// </summary> /// <param name="connection"> /// The AMQP connection to use. /// </param> /// <param name="topicName"> /// The topic name to publish to. /// </param> /// <param name="name"> /// The unique name to associate with the link used to send messages on. /// </param> /// <param name="isDurable"> /// Indicates whether the messages should be durable (Persistent). /// </param> public MqttMessagePublisher(MqttConnection connection, string topicName, string name, bool isDurable = true) { connection.ShouldNotBeNull(); topicName.ShouldNotBeEmpty(); name.ShouldNotBeEmpty(); m_ConnectionId = string.Empty; m_Connection = connection; m_TopicName = topicName; m_Name = name; m_IsDurable = isDurable; }