Hi Ashesh,

did you manage to solve your problem?

Configuration seems to be alright. Was your akka application and
playframework application running on the same machine?

I am not quite sure about default playframework akka configuration, but you
may have to enable remoting on your playframework app manually:
http://qiita.com/visualskyrim/items/350ba0112cd9a95388ff

On Mon, Feb 16, 2015 at 8:20 PM, Ashesh Ambasta <[email protected]>
wrote:

> I have a very simple Akka system that is structured like;
> scala/
>   /actors
>     …
>     …
>   /helpers
>   /lib
>   Startup.scala
>
> Startup.scala is the parent actor I'd like to use that coordinates all
> messages received by the system. It looks quite simple;
> import actors.PushActor
> import actors.publishers.facebook.Facebook
> import akka.actor.{Terminated, ActorSystem, Props}
> import com.typesafe.config.{ConfigFactory, Config}
> import helpers.signals.{Ok, Stop}
> import models.places.placegroups.places.Place
> import models.providers.Provider
> import models.relationships.places.PlaceProvider
> import org.joda.time.DateTime
> import scala.collection.JavaConversions._
> import scala.collection.parallel.mutable
>
>
> /**
>  * Created by asheshambasta on 19/01/15.
>  */
>
>
> object Startup extends App {
>   val SYSTEM_NAME = "centralapp-push"
>   val system = ActorSystem(SYSTEM_NAME)
>   val pushSystem = system.actorOf(Props(PushSystem), "centralapp-push")
> }
>
>
> object PushSystem extends PushActor {
>   val conf: Config = ConfigFactory.load
>   val providers = conf.getStringList("core.providers")
>   val providerActors = providers.toList.foldLeft(scala.collection.mutable.
> Map[String, Int]())((acc: scala.collection.mutable.Map[String, Int],
> provider: String) => acc + (provider -> 0))
>   log.info("providerActors " + providerActors)
>
>
>   def actorKey(ppr: PlaceProvider) = {
>     providerActors.get(ppr.provider.name).getOrElse(None) match {
>       case None => "_"
>       case count: Int => {
>         providerActors(ppr.provider.name) = count + 1
>         ppr.provider.name + "_" + count + "_" + (new DateTime)
>       }
>     }
>   }
>
>
>   /*START TEST CODE*/
>   val fb = new Provider("facebook")
>   val place = new Place("CentralApp")
>   val ppr = new PlaceProvider
>   ppr.provider = fb
>   ppr.token = "random_string_access_token"
>   ppr.place = place
> //  val facebookPub2 = context.actorOf(Props(new Facebook), actorKey(ppr))
> ////  val facebookPub3 = context.actorOf(Props(new Facebook),
> actorKey(ppr))
> //  context.watch(facebookPub2)
> //  facebookPub2 ! ppr
> //  facebookPub3 ! ppr
>   self ! ppr
>   /*END TEST CODE*/
>
>
>   def receive = {
>     case ok: Ok => {
>       log.info("Received OK: " + ok.message)
>     }
>     case err: helpers.signals.Error => {
>       log.error("Received Error: " + err.message)
>     }
>     case ppr: PlaceProvider => {
>       val key = actorKey(ppr)
>       ppr.provider.name match {
>         case "facebook" => {
>           val fbActor = context.actorOf(Props(new Facebook), key)
>           fbActor ! ppr
>         }
>       }
>     }
>   }
> }
>
>
> The application.conf file looks like;
> akka {
>   log-dead-letters = 0
>   actor {
>     provider = "akka.remote.RemoteActorRefProvider"
>   }
>   remote {
>     enabled-transports = ["akka.remote.netty.tcp"]
>     netty.tcp {
>       hostname = "127.0.0.1"
>       port = 2552
>     }
>   }
> }
> redis {
>   hostname = "localhost"
>   port = 6379
> }
> core {
>   providers = ["facebook", "foursquare"]
> }
>
>
> The test code above runs as it should, and outputs when it runs that its
> listening on the right address:
>
> [INFO] [02/16/2015 19:07:18.511] [main] [Remoting] Remoting now listens
> on addresses: [akka.tcp://[email protected]:2552]
>
>
> Next I have a Play! application that I'd like to enable to send messages
> to this *master* actor that keeps running.
>
> What the code in an action looks like is simple:
>           /*START PUSH INTEGRATION*/
>           Logger.info("Attempting to connect with Push")
>           val selection = Akka.system().actorSelection("akka.tcp://
> [email protected]:2552/user/centralapp-push")
>           // OR: val selection = Akka.system().actorSelection("akka.tcp://
> [email protected]:2552")
>           println(selection)
>           val fb = new Provider("facebook")
>           val place = new Place("CentralApp")
>           val ppr = new PlaceProvider
>           ppr.provider = fb
>           ppr.token = "random_string_access_token"
>           ppr.place = place
>           selection ! ppr
>           selection ! "hello"
>           /*END PUSH INTEGRATION*/
> And once this is done, I'm unable to connect to the remote Akka system.
> The rest of the code outputs that the message wasn't delivered since
> deadLetters were encountered.
>
> I'm rather new to Akka. What is going 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Martynas Mickevičius
Typesafe <http://typesafe.com/> – Reactive
<http://www.reactivemanifesto.org/> Apps on the JVM

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
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