Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Set Properties for willTopic not working.

Hi!

I have an "connected" Topic for every application which is is published with "1" at startup, and I set the willTopic with value "0" so every participant knows if the other application is connected and running.

My Ppoblem is that it seems that the UserProperties are ignored for the will topic.

I set theses properties like this.

MqttProperties props = new MqttProperties();

props.setUserProperties(List.of(new UserProperty(UserProps.Sender.toString(), this.clientId), new UserProperty(UserProps.Datatype.toString(), Datatype.BOOL.toString()),
new UserProperty(UserProps.Timestamp.toString(), "0"), new UserProperty(UserProps.Acknowledge.toString(), Boolean.toString(false))));

MqttMessage message = new MqttMessage("0".getBytes());
message.setQos(QoS.ExactlyOnce.level);
message.setRetained(true);
message.setProperties(props);

connOpts.setWill(willTopic, message);

mosquitto_sub -t '+/+/CORE/connected' -V mqttv5 -F "%t %P %p"
DEFAULT/s7tcp/CORE/connected Sender:s7tcp Datatype:BOOL Timestamp:1688539417151 Acknowledge:false 1
DEFAULT/s7tcp/CORE/connected  0





--
Mit freundlichen Grüßen
Bachmair Florian
flexSolution GmbH
Lothringenstraße 1
4501 - Neuhofen / Krems
Austria
Phone:
+43 7227 22022 42
Fax:
+43 7227 22022 5

Back to the top