Maybe just move the bind call into my routing actor, in response to some
sort of Start message ?

On Mon, Sep 7, 2015 at 8:38 AM, Richard Rodseth <rrods...@gmail.com> wrote:

> I'm trying Akka Http for the first time, coming from Spray. In Spray I
> have  a routing actor which extends HttpService and is passed to HttpBind
> as shown below. This way routes can create per-request actors as a child of
> the routing actor.
> What would be the equivalent in Akka Http?
>
> I'm not so worried about the bind responder stuff right now, but here's
> what my Spray initialization looks like:
>
> class BindResponder(service: ActorRef, system:ActorSystem) extends Actor
> with ActorLogging {
>      def receive = {
>       case b @ Http.Bound(connection) => {
>         log.info(s"Successfully bound, starting processing $b")
>         ...
>         self ! PoisonPill
>
>       }
>       case cf @ Http.CommandFailed(command) => {
>         log.error(s"Binding failed, shutting down process $cf")
>         System.exit(0)
>         // TODO In future we might try to shutdown the actor system
> cleanly, but
>         // that is non-trivial
>         // system.shutdown()
>       }
>     }
>
>   }
>
>    val bindResponder = system.actorOf(Props(new
> BindResponder(serviceActor, system)))
>
>   IO(Http)(system).tell(Http.Bind(this.routingActor, hostName, port =
> servicePort),bindResponder)
>
>

-- 
>>>>>>>>>>      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