Created
February 13, 2023 16:27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void onNewMessage(String key, String msg) { | |
logger.info("onNewMessage: " + key + " . " + msg); | |
HashMap<String, String> update = new HashMap<String, String>(); | |
// We have to set the key | |
update.put("key", key); | |
String[] tknz = msg.split("\\|"); | |
if ( keys.contains( key) ) { | |
if (tknz[3].equalsIgnoreCase("Deleted")) { | |
// delete | |
logger.info("delete"); | |
update.put("command", "DELETE"); | |
keys.remove(key); | |
} else { | |
// UPDATE command | |
logger.info("update"); | |
update.put("command", "UPDATE"); | |
} | |
} else { | |
// ADD command | |
logger.info("add"); | |
update.put("command", "ADD"); | |
keys.add(key); | |
} | |
update.put("destination", tknz[0]); | |
update.put("departure", tknz[1]); | |
update.put("terminal", tknz[2]); | |
update.put("status", tknz[3]); | |
update.put("airline", tknz[4]); | |
listener.update("DepartureMonitor", update, false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment