> 3 okt. 2016 kl. 14:30 skrev gervais.b <[email protected]>:
> 
> Hello,
> 
> I'm fairly new with Akka (and maybe the whole question below is polluted by 
> my synchronous background). In my app, I have to parse 2 CSV available as 
> HTTP, I plan to access them from one actor that accept two messages (one per 
> csv). But I should add another HTTP resources next week. So I'm planning to 
> create one 'HttpFetch'. My question is about the reply for this actor. Should 
> use tell or ask ? 
> 
> With ask everything seems simple, I ask for a resource and receive a Future 
> that I can map. But I have the feeling that ask must be used in border cases.
> With tell then the 'HttpFectch' actor will receive 'Get(target:URI)' and send 
> the response later with a 'Got(target: URI, response:..)'. That's nice and 
> looks simple also. But I have to combine the result of the two CSV (find 
> "tag" in first and filter lines of second based on this "tag"). So I have to 
> maintains state in my actor and I know this is a bad idea.

Maintaining state is the only point of an actor, that’s definitely not a bad 
idea :-) Where did you get the notion that actors should be stateless?

> So, what is the best pattern to send and combine the response of two messages 
> ?

I’d prefer the tell variant and create a new Actor for each such combination. 
This way you can focus on the business logic without getting distracted by 
incidental concerns like managing multiple such processes in parallel—which 
would then be governed by the actor library for you.

Regards,

Roland

> 
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/>
> >>>>>>>>>> Check the FAQ: 
> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html 
> >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html>
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user 
> >>>>>>>>>> <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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/akka-user 
> <https://groups.google.com/group/akka-user>.
> For more options, visit https://groups.google.com/d/optout 
> <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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to