I am a beginner to akka and spray world. I have some confusions about the 
service actor used to handle HTTP messages. For example the service Actor 
defined at Spray-can server 
example<https://github.com/spray/spray/blob/release/1.2/examples/spray-can/simple-http-server/src/main/scala/spray/examples/DemoService.scala>:
 
I can see the akka configuration given as

akka {
  loglevel = INFO
  event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
}

According to my understanding it's defining a local actor without remote 
capabilities. But I am not able to understand how this actor can understand 
HTTP messages. Probably I couldn't understand the meaning of the last line in 
the following code properly:

object Main extends App with MySslConfiguration {

  implicit val system = ActorSystem()

  // the handler actor replies to incoming HttpRequests
  val handler = system.actorOf(Props[DemoService], name = "handler")

  IO(Http) ! Http.Bind(handler, interface = "localhost", port = 8080)
}

I am confused: whether "handler is a local actor here" or "it's a remote actor 
which can understand HTTP messages" or "Spray can translates these HTTP 
requests into actor messages". 

One of my team member tried to configure the Spray service actor to make it 
cluster member (a cluster of akka actors based on pub-sub extension) and some 
how he is getting error messages. We are not able to configure the Spray 
service actor to join the akka pub-sub cluster.

Please help me understand the meaning of 

IO(Http) ! Http.Bind(handler, interface = "localhost", port = 8080)

and is it possible to configure the Spray service actor to be a part of akka 
pub-sub cluster.


On Friday, February 7, 2014 2:01:05 PM UTC+5:30, Björn Antonsson wrote:
>
> Hi,
>
> I don’t really understand what you mean by making the actor part of the 
> cluster directly?
>
> If your actor system that use Spray is part of a cluster, then it is part 
> of the cluster.
>
> What are you trying to achieve? What is your use case? 
>
> B/
>
> On 7 February 2014 at 07:41:23, Vaibhav Raj 
> ([email protected]<javascript:>) 
> wrote:
>
> Sorry for late reply.
>
> I was trying to make the spray service actor, a part of the akka cluster 
> directly. I could not find a proper example for the same. So, just wanted 
> to know is that possible. 
>
> On Thursday, January 30, 2014 12:56:42 PM UTC+5:30, √ wrote: 
>>
>> Hi Valbhav, 
>>
>> What did you try and what happened?
>>
>> Chees,
>> √
>>  
>>
>> On Thu, Jan 30, 2014 at 7:06 AM, Vaibhav Raj <[email protected]>wrote:
>>
>>> Is it possible to create an actor which can communicate using two 
>>> different protocols. My question is in context of Spray-Can service actor 
>>> which listens for http messages. Can we add implimentaion for akka:tcp in 
>>> spray service actor so that it can join the akka cluster directly?
>>> --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>> >>>>>>>>>> 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/groups/opt_out.
>>>
>>  
>>
>>
>> --
>>   Cheers,
>>  √
>>  
>>   *———————*
>> *Viktor Klang* 
>> *Chief Architect - **Typesafe <http://www.typesafe.com/>* 
>>
>>   Twitter: @viktorklang
>>   
>  --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
> >>>>>>>>>> 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] <javascript:>.
> To post to this group, send email to [email protected]<javascript:>
> .
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> -- 
> Björn Antonsson
> Typesafe <http://typesafe.com/> – Reactive Apps on the JVM
> twitter: @bantonsson <http://twitter.com/#!/bantonsson>
>
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: http://akka.io/faq/
>>>>>>>>>>      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/groups/opt_out.

Reply via email to