playframework - Calling Akka actor from Play controller -


i have been playing distributed worker pattern , i'm running issue pushing work web request.

the example project has frontend:

val mediator = distributedpubsubextension(context.system).mediator    def receive = {     case work =>       log.info("frontend received: " + work.tostring())       implicit val timeout = timeout(5.seconds)       (mediator ? send("/user/master/active", work, localaffinity = false)) map {         case master.ack(_) => ok       } recover { case _ => notok } pipeto sender   } 

and workproducer:

override def prestart(): unit =     scheduler.scheduleonce(5.seconds, self, tick)  def receive = {     case tick =>       n += 1       log.info("produced work: {}", n)       val work = work(nextworkid(), n)       frontend ! work       context.become(waitaccepted(work), discardold = false)    } 

this works fine, when send directly frontend play framework controller:

def multiply(num: long) = action {     implicit request =>         implicit val timeout = timeout(5.seconds)         val frontend = core.main.frontend         frontend ! num         ok   } 

the message seems lost. frontend receives message seems actors down stream not.

i have modified play config use clusteractorrefprovider

play {   akka {     extensions = ["akka.contrib.pattern.clusterreceptionistextension"]         actor.provider = "akka.cluster.clusteractorrefprovider"     remote.netty.tcp.port=0         } } 

but no avail.

i've been muppet , haven't sent correct message, controller should this:

def multiply(num: long) = action {     implicit request =>         implicit val timeout = timeout(5.seconds)         val frontend = core.main.frontend         val work = work(nextworkid(), num)         frontend ! work         ok   } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -