scala - Akka actor remote dissociation from sending a delayed response -
so have client server based program, client send request server, server computation , response. done via ask.
specifically client receive message client app , send call ask
val response = ask(actorref, sessionmessage(token, message)).mapto[responsemessage] the server receive so
val response = sessionmessage.message match { case message: message1 => ask(actorset.actor1,message) case message: message2 => ask(actorset.actor2,message) where actorset literally set of different actors.
i collect result , send sender
val responseresult = response.mapto[responsemessage] responseresult pipeto sender the problem i'm running of requests, database query can take while (5-10 minutes) , when query completes sends dead letters , dissociation , unable associate again , sends dead letters.
i thought because took long, sender time out (or sender reference) stored sender reference val, , confirmed doing sender reference lost. however, as query finishes , pipe correct sender, dissociates. other queries take minute or don't seem suffer problem, ones last few minutes dissociate , need restart server or server keep sending dead letters.
even if oncomplete send on success or await.result, same issue occurs, tries send message (after completion) server dissociates , sends dead letters.
i'm @ lost why happening.
the problem ask has timeout, separate timeout might specify in await.result. full signature ask is:
def ask (actorref: actorref, message: any)(implicit timeout: timeout): future[any] this means if did not manually provide value timeout , did not define implicit yourself, must inheriting 1 via 1 of imports.
to extend timeout particular ask, call one:
ask(actorref, sessionmessage(token, message))(15.minutes).mapto[responsemessage] or if applies asks in scope, declare own implicit:
implicit val timeout = timeout(15.minutes)
Comments
Post a Comment