Created
May 30, 2018 13:33
-
-
Save teivah/bf18bc2f64e29502e8603f09e618a07e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Orchestration based on setHandler | |
private void method1() { | |
// Create first step | |
Future<String> future1 = readFile(); | |
// Set handler on future1 | |
future1.setHandler(res1 -> { | |
if (res1.succeeded()) { | |
Future<String> future2 = writeFile(res1.result()); | |
// Set handler on future 2 | |
future2.setHandler(res2 -> { | |
if (res2.succeeded()) { | |
Future<String> future3 = copyFile(res2.result()); | |
// Set handler on future 3 | |
future3.setHandler(res3 -> { | |
if (res3.succeeded()) { | |
System.out.println(res3.result()); | |
} else { | |
// Manage doSmthg3 errors | |
} | |
}); | |
} else { | |
// Manage doSmthg2 errors | |
} | |
}); | |
} else { | |
// Manage doSmthg1 errors | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment