Skip to content

Commit

Permalink
Respond to unsuitable input messages with error
Browse files Browse the repository at this point in the history
  • Loading branch information
cube committed Jul 26, 2024
1 parent 97c3941 commit 4e72647
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/jpackage/resources-linux/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ set -e
# the debian-policy package

echo $0 called with $*
printenv | sort
pwd

package_type=deb
LAUNCHER_AS_SERVICE_SCRIPTS
Expand Down
2 changes: 2 additions & 0 deletions src/jpackage/resources-linux/prerm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ set -e


echo $0 called with $*
printenv | sort
pwd

package_type=deb
#COMMON_SCRIPTS
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/oolite/starter/mqtt/MQTTAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class MQTTAdapter implements PlistListener {
private String TOPIC_OOLITE_LOG = "oolite/log";
private String TOPIC_OOLITE_WORLDEVENT = "oolite/worldEvent";
private String TOPIC_OOLITE_SHOWCONSOLE = "oolite/showConsole";
private String TOPIC_OOLITE_ERROR = "oolite/starter";

/**
* Creates a new instance.
Expand Down Expand Up @@ -69,6 +70,7 @@ public void init(TCPServer tcpServer, Installation.Mqtt mqtt) {
TOPIC_OOLITE_LOG = MqttUtil.getTopic(prefix, "oolite/log");
TOPIC_OOLITE_WORLDEVENT = MqttUtil.getTopic(prefix, "oolite/worldEvent");
TOPIC_OOLITE_SHOWCONSOLE = MqttUtil.getTopic(prefix, "oolite/showConsole");
TOPIC_OOLITE_ERROR = MqttUtil.getTopic(prefix, "oolite/starter");

this.tcpServer = tcpServer;
tcpServer.addConnectorStatusListener(new Connector.ConnectorStatusListener() {
Expand Down Expand Up @@ -127,6 +129,7 @@ public void messageArrived(String topic, MqttMessage mm) throws Exception {
}
} catch (Exception e) {
log.error("Could not consume message {}", mm);
sendMqtt(TOPIC_OOLITE_ERROR, String.format("Could not consume message %s", String.valueOf(mm)));
}
}
});
Expand Down

0 comments on commit 4e72647

Please sign in to comment.