Package net.bjmsw.hda.vs.helper
Class MessageClient
java.lang.Object
net.bjmsw.hda.vs.helper.MessageClient
The MessageClient class provides methods to publish messages using the MQTT protocol.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe SpielEvent class represents an event that occurred in a game. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) org.eclipse.paho.client.mqttv3.MqttClientThis variable represents an MQTT client used to publish messages using the MQTT protocol. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidpublishLeaderTrigger(long spielId) Publishes a leader trigger event to the MQTT broker for a specified Spiel ID.voidpublishSpielEvent(Spiel spiel, MessageClient.SpielEvent event) Publishes a Spiel event to the MQTT broker.
-
Field Details
-
client
org.eclipse.paho.client.mqttv3.MqttClient clientThis variable represents an MQTT client used to publish messages using the MQTT protocol.
-
-
Constructor Details
-
MessageClient
public MessageClient() throws org.eclipse.paho.client.mqttv3.MqttExceptionThe MQTT client used to publish messages.- Throws:
org.eclipse.paho.client.mqttv3.MqttException
-
-
Method Details
-
publishSpielEvent
public void publishSpielEvent(Spiel spiel, MessageClient.SpielEvent event) throws org.eclipse.paho.client.mqttv3.MqttException Publishes a Spiel event to the MQTT broker.- Parameters:
spiel- The Spiel object representing the game.event- The SpielEvent object representing the event.- Throws:
org.eclipse.paho.client.mqttv3.MqttException- if there is an error during the publishing process.
-
publishLeaderTrigger
public void publishLeaderTrigger(long spielId) Publishes a leader trigger event to the MQTT broker for a specified Spiel ID.- Parameters:
spielId- The ID of the Spiel for which the leader trigger event is being published.
-