Currently round-trips don't directly support futures; you can, however,
wrap the Scala Future with a Stream instead—i.e., the Future would
map to a 1-item Stream, which item will become available when the
Future completes.
you a bit more control over things. It's basically the thing you pass as the
right hand side of "save" ->. It takes itself as a second parameter, so that
you can deal with it accordingly. A quick-and-dirty implementation for this
case:
You can also implement your own handler for round-trips by taking
send data arbitrarily and send a message when things are done or
when something has failed. A quick-and-dirty example for this case:
def doSave(item: JValue, roundTrip: RoundTripHandlerFunc): Unit = {
val future = getFutureFromSlick(item)
future.onSuccess {
case slickItem: <TYPE> =>
roundTrip.send(<JValue or JsCmd or JsExp>)
roundTrip.done()
}
future.onFailure {
case thingie: Exception =>
roundTrip.failure(thingie.getMessage())
roundTrip.done() // might not be needed, not 100% sure
}
}
Disclaimer: don't think I've tried my own RoundTripHandlerFunc before,
so things may not work exactly right above.
Thanks,
Antonio