MQTTnet
MQTTnet copied to clipboard
ManagedMqttClient.PublishAsync unstable when using Queueing
Describe the bug
if I use the simple Task.PublishAsync that enqueue my publish, it does never send it. If I use the other prototype that takes MqttApplicationMessageBuilder message (not the queued one), and returns MqttClientPublishResult, then it apparently does not use the queueing system, and send instantly my publication to the broker.
Do I need to manage other properties of the Managed Implementation to ensure some king of 'performance' in the Managed Queue version of the publish ?
Which project is your bug related to?
- ManagedClient
To Reproduce
Steps to reproduce the behavior: MQTTNet version is 3.0.13
When using this code :
private IManagedMqttClient m_mqttclient = null;
....
var message = new MqttApplicationMessageBuilder()
.WithTopic(topic)
.WithPayload(payload)
.WithRetainFlag(false)
.Build();
MqttClientPublishResult _result = await m_mqttclient.PublishAsync(message, CancellationToken.None);
Publish is done Well.
But when using :
var message = new ManagedMqttApplicationMessageBuilder()
.WithApplicationMessage(new MqttApplicationMessageBuilder()
.WithTopic(topic)
.WithPayload(payload)
.WithRetainFlag(false)
.Build())
.Build();
await m_mqttclient.PublishAsync(message);
Nothing Appends. Message seems to b queued but not received by the Mqtt Broker...
Expected behavior
Queue should be parsed at a time, to dequeue and effectively push messages to the Broker, but.....
Basically Publish with a regular application message is just an overload for the managed mqtt application message version of the method.
The managed client works fully autonomous and has an internal queueing mechanism so it will always return without even sending the message.
@chkr1011
Thanks for the feedback. Of course I understand well that in case of queueing, the send process is done background and potentially with delay, but when I say it does not send anything, it is not only on return, but even after a couple of minutes !
Knowing that the client has not so much things to do after the publish, it should be a couple of seconds.
@LouisCPro Sounds strange to me. Could you please try the regular MQTTClient? I only want to know whether that client performs better than the managed one.
@chkr1011
With the regular MqttClient, no problem !
That sounds really strange to me. I will have a look.