Thanks for the link to that sample.
The other problem in doing per-request actors without ask pattern, as in
the net-a-porter sample seems to be that Routes are no longer defined as
RequestContext => Unit. Any thoughts on that? Are we now required to use
Futures (or Flows?) to bridge routing with actors?


On Mon, Sep 7, 2015 at 10:18 PM, Heiko Seeberger <loe...@posteo.de> wrote:

> On 07 Sep 2015, at 19:32, Richard Rodseth <rrods...@gmail.com> wrote:
>
> Maybe just move the bind call into my routing actor, in response to some
> sort of Start message ?
>
>
> Yep.
>
> Here’s a similar example:
> https://github.com/hseeberger/reactive-flows/blob/master/src/main/scala/de/heikoseeberger/reactiveflows/HttpService.scala#L133
>
> Pay attention to not use any actor state/internals in the route, i.e.
> define the route in the companion object.
>
> Cheers
> Heiko
>
>
>
> 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.
>
>
> --
> >>>>>>>>>> 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.
>

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