I have been playing with the distributed worker pattern 
<http://goo.gl/vMGTgf> and I'm running into an issue pushing work from a 
web request.

The example project has a 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 a 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 all works just fine, when I send directly to the frontend from my 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 to get lost. The frontend receives the message but it 
seems the actors down stream do not.

I have modified the play config to use a ClusterActorRefProvider

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

But to no avail. Does anybody have an idea what I'm doing wrong here?

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to