Bob, I'm still struggling with the CONNECT/DISCONNECT issue. The current design seems sensible but since I'm using Stage programming I think that's causing issues.
I have a project that uses a FIFO to send data via MQTT. If the Publish fails it runs a timer for 30 seconds then retries until successful. I'm finding that if the broker is down and the FIFO starts to fill, on reconnect the PLC attempts to publish each message as desired, but only every other message makes it to the broker. This might be a timing thing but the messages that get lost show in Logger as being processed during MQTT Disconnect. All very strange.
Since each individual message is connecting, publishing and then disconnecting, I still have the original concern about LWT processing not functioning properly.
Is there a way I can program this so that it works properly or do I need to request again that you add CONNECT and DISCONNECT functionality?
Logger output is below (latest at the top). I can email you the program export if necessary.
Thanks, Andrew.
---- LOGGER STARTS ----
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.799 ,"MQTT OK "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.798 ,"MQTT disconnected!"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.797 ,"Disconnecting MQTT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.745 ,"Sending DISCONNECT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.743 ,"Stage S20 / 5 / 0 / 1561924365 "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.740 ,"MQTT OK "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.739 ,"PUBACK received"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.737 ,"Sending PUBLISH for V2/TEST/4"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.736 ,"CONNACK received"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.733 ,"Sending CONNECT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.729 ,"MQTT broker connected!"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.728 ,"Connecting to MQTT broker..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.721 ,"Stage S20 / 4 / 0 / 1561924364 "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.721 ,"MQTT OK "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.720 ,"MQTT disconnected!"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.719 ,"Disconnecting MQTT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.648 ,"Sending DISCONNECT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.648 ,"Stage S20 / 2 / 0 / 1561924363 "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.647 ,"MQTT OK "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.646 ,"PUBACK received"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.646 ,"Sending PUBLISH for V2/TEST/3"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.645 ,"CONNACK received"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.645 ,"Sending CONNECT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.644 ,"MQTT broker connected!"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.644 ,"Connecting to MQTT broker..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.643 ,"Stage S20 / 3 / 0 / 1561924362 "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.643 ,"MQTT OK "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.642 ,"MQTT disconnected!"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.641 ,"Disconnecting MQTT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.502 ,"Sending DISCONNECT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.501 ,"Stage S20 / 1 / 0 / 1561924362 "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.501 ,"MQTT OK "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.499 ,"PUBACK received"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.498 ,"Sending PUBLISH for V2/TEST/5"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.497 ,"CONNACK received"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.495 ,"Sending CONNECT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.493 ,"MQTT broker connected!"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.492 ,"Connecting to MQTT broker..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.490 ,"Stage S20 / 5 / 1 / 1561924360 "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.489 ,"MQTT OK "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.487 ,"MQTT disconnected!"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.485 ,"Disconnecting MQTT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.413 ,"Sending DISCONNECT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.412 ,"Stage S20 / 4 / 1 / 1561924360 "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.412 ,"MQTT OK "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.411 ,"PUBACK received"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.411 ,"Sending PUBLISH for V2/TEST/3"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.410 ,"CONNACK received"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.410 ,"Sending CONNECT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.409 ,"MQTT broker connected!"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.409 ,"Connecting to MQTT broker..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.409 ,"Stage S20 / 3 / 1 / 1561924359 "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.408 ,"MQTT OK "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.408 ,"MQTT disconnected!"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.407 ,"Disconnecting MQTT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.262 ,"Sending DISCONNECT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.261 ,"Stage S20 / 2 / 1 / 1561924358 "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.260 ,"MQTT OK "
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.258 ,"PUBACK received"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.256 ,"Sending PUBLISH for V2/TEST/1"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.255 ,"CONNACK received"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.254 ,"Sending CONNECT..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.253 ,"MQTT broker connected!"
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.252 ,"Connecting to MQTT broker..."
10.0.75.1 Port 29298(0x7272),06/30/19 12:53:09.251 ,"Stage S20 / 1 / 1 / 1561924358 "
---- LOGGER ENDS ----