Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Provide alternative method to execute when future failed
- */
- def fallbackTo(): Unit = {
- val f: Future[String] = downloadBlob("ftp://blobs/8671").fallbackTo {
- println(s"fetch from ftp")
- // fetch blob via ftp
- fetchBlob("ftp://blobs/8671")
- }
- println(Await.result(f, 10.seconds))
- }
- /*
- * output
- fetch from ftp
- cmFoYXNhayBsYWJz
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement