public class MyWire extends Wire<String, Integer> {
private String input;
private Integer output;
@Override
protected void onReceive(String data) {
this.input = data;
// ...
}
@Override
protected void onSend() {
this.output = processData(this.input);
send(this.output);
}
private Integer processData(String input) {
// ...
}
// ...
}
public class Main {
public static void main(String[] args) {
MyWire wire1 = new MyWire();
MyWire wire2 = new MyWire();
wire1.outputTo(wire2);
ConduitFramework.start(wire1, wire2);
wire1.send("Hello");
ConduitFramework.waitForCompletion();
Integer result = wire2.getOutput();
System.out.println("Result: " + result);
}
}