[writing-async-app-in-scala-part-3] direct executor context usage
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
def rpcCall: Future[String] | |
def daoCall(id: String): Future[Int] | |
def extractId(idStr: String): Future[String] | |
def convertDbValue(value: Int): Future[Int] | |
import directExecutionContext | |
for { | |
idStr <- rpcCall | |
id <- extractId(idStr) // executed in RPC execution context | |
valueFromDb <- daoCall(id) | |
value <- convertDbValue(valueFromDb) // executed in DAO execution context | |
} yield value // executed in DAO execution context |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment