Skip to content

Commit

Permalink
now a proper error is printed if connection to mqtt broker is not pos…
Browse files Browse the repository at this point in the history
…sible
  • Loading branch information
pkohout committed May 14, 2024
1 parent 654e946 commit 02bb7f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/src/main/java/com/rcll/java/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static void main(String[] args) throws MqttException, InterruptedExceptio
parsed = parser.parse(options, args);
} catch (Exception e) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("java -jar mqtt-bridge-0.1-all.jar", options);
formatter.printHelp("java -jar mqtt-bridge-0.5-all.jar", options);
return;
}

Expand All @@ -38,12 +38,18 @@ public static void main(String[] args) throws MqttException, InterruptedExceptio
log.warn("did you forget to add the protocol prefix i.e \"tcp://\" to the broker url?");
}
IMqttClient publisher = new MqttClient(brokerUrl, publisherId);
publisher.connect();
try {
publisher.connect();
} catch(MqttException me) {
log.error("Error on connecting to mqtt broker[" + brokerUrl + "] - is it Running? Msg: " + me.getMessage(), me.getCause());
System.exit(1);
}
RefboxConnectionConfig connectionConfig = new RefboxConnectionConfig(
parsed.getOptionValue("r"),
new PeerConfig(4444, 4445),
new PeerConfig(4441, 4446),
new PeerConfig(4442, 4447));
log.info("HERE");
TeamConfig teamConfig = new TeamConfig(parsed.getOptionValue("k"), parsed.getOptionValue("t"));
RefboxHandler privateHandler = new RefboxHandler();
RefboxHandler publicHandler = new RefboxHandler();
Expand Down

0 comments on commit 02bb7f8

Please sign in to comment.