20 lines
520 B
Java
20 lines
520 B
Java
void main(String[] arguments) throws Exception {
|
|
if (arguments.length != 2) {
|
|
IO.println("Usage: java Mediator.java <from-mailbox> <to-mailbox>");
|
|
return;
|
|
}
|
|
|
|
var from = arguments[0];
|
|
var to = arguments[1];
|
|
|
|
IO.println("Mediating: " + from + " -> " + to);
|
|
|
|
FileMessageBoard.watch(from, message -> {
|
|
try {
|
|
FileMessageBoard.publish(to, message);
|
|
} catch (IOException exception) {
|
|
throw new UncheckedIOException(exception);
|
|
}
|
|
});
|
|
}
|