Skip to content

Commit eabfbf6

Browse files
authored
Merge pull request #548 from wes-johnson/develop
[#547] Modified spec to better handle invalid PHID messages
2 parents 90dd3a4 + ed32df1 commit eabfbf6

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

specification/src/main/asciidoc/chapters/Sparkplug_5_Operational_Behavior.adoc

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ was connected to that MQTT Server and known by the Host Application MUST be upda
143143
quality if the Host Application loses connection to the MQTT Server.*#
144144

145145
[tck-testable tck-id-message-flow-hid-sparkplug-state-message-delivered]#[yellow-background]*[tck-id-message-flow-hid-sparkplug-state-message-delivered] After
146-
publishing its own Host Application STATE message, if at any point the Host Application is delivered
147-
a STATE message on its own Host Application ID with a 'online' value of false, it MUST immediately
148-
republish its STATE message to the same MQTT Server with a 'online' value of true and the
149-
'timestamp' set to the same value that was used for the timestamp in its own prior MQTT CONNECT
150-
packet Will Message payload.*#
146+
publishing its own Host Application online STATE message, if at any point the Host Application is delivered
147+
a STATE message on its own Host Application ID with a timestamp that is newer than the timestamp
148+
that was used in its own immediately prior MQTT CONNECT packet Will Message, it MUST immediately
149+
disconnect from the MQTT Server and reconnect. It MUST follow the standard rules for Host
150+
Applications when establishing the connection to the MQTT Server.
151151

152152
[[operational_behavior_edge_node_session_establishment]]
153153
=== Edge Node Session Establishment
@@ -634,8 +634,11 @@ plantuml::{assetsdir}assets/plantuml/primary-host-application-state-flow-diagram
634634
. When an Edge Node is configured with multiple available MQTT Servers in the infrastructure it
635635
should issue a subscription to the Primary Host Application STATE message. The Edge Nodes are free
636636
to establish an MQTT Session to any of the available servers over any available network at any time
637-
and examine the current STATE value. If the STATE message payload is online=false then the Edge Node
638-
should disconnect and walk to the next available server.
637+
and examine the current STATE value. If the STATE message payload is online=false and the timestamp
638+
in the payload is older than the previous timestamp received for this Host Application, then the
639+
Edge Node must disconnect and walk to the next available server. If the Edge Node had never
640+
received a previous STATE message for this Host Application, it must honor the online flag and store
641+
the timestamp for future comparisons.
639642

640643
. Upon startup, the configured Primary Host Application's MQTT Client MUST include the Primary Host
641644
Application DEATH Certificate that indicates STATE is online=false with the message RETAIN flag set
@@ -647,7 +650,10 @@ number and represent the number of UTC nanoseconds since Epoch.
647650
. As the Edge Node walks its available MQTT Server list, it will establish an MQTT Session with a
648651
server that has a STATE message with a JSON payload that has online=true. The Edge Node can stay
649652
connected to this server if its MQTT Session stays intact and it does not receive the Primary Host
650-
Application DEATH Certificate.
653+
Application DEATH Certificate. The Edge Node MUST only honor STATE messages if the incoming
654+
timestamp is newer than or equal to the previous timestamp for this Host Application. If the Edge
655+
Node has not seen a STATE message within its current MQTT Session, it also MUST honor the STATE
656+
message.
651657

652658
. Having a subscription registered to the MQTT Server on the STATE topic will result in any change
653659
to the current Primary Host Application STATE being received immediately. In this case, a

specification/src/main/asciidoc/chapters/Sparkplug_6_Payloads.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1982,7 +1982,7 @@ whether or not the Sparkplug Host Application is online and operational or not.
19821982
* [tck-testable tck-id-payloads-state-will-message]#[yellow-background]*[tck-id-payloads-state-will-message] Sparkplug
19831983
Host Applications MUST register a Will Message in the MQTT CONNECT packet on the topic
19841984
'spBv1.0/STATE/[sparkplug_host_id]'.*#
1985-
** The [sparkplug_host_id] should be replaced with the Sparkplug Host Application's ID. This can be any
1985+
** The [sparkplug_host_id] must be replaced with the Sparkplug Host Application's ID. This can be any
19861986
UTF-8 string.
19871987
* [tck-testable tck-id-payloads-state-will-message-qos]#[yellow-background]*[tck-id-payloads-state-will-message-qos] The
19881988
Sparkplug Host Application MUST set the the MQTT Will QoS to 1 in the MQTT CONNECT packet.*#

0 commit comments

Comments
 (0)