Ha! That's helpful! I thought about using intermediate message object, but 
copy is a better way. Thanks!

On Tuesday, May 20, 2014 6:24:47 AM UTC-4, Martynas Mickevičius wrote:
>
> You should have fields of your case class immutable. Then you can pass it 
> between actors completing the fields as it goes along with 
> entry.copy(fieldName = newValue).
>
>
> On Mon, May 19, 2014 at 11:32 PM, Allen Nie <[email protected]<javascript:>
> > wrote:
>
>> Hey,
>>
>>     I decided to use Akka actors to do some parallel processing 
>> (primarily file downloading and database insertion/updating). The original 
>> design of the program follows a sequential line: START -> Download Files, 
>> generate half of database entry -> Access a http link, complete the rest 
>> half of database entry -> Store the database Entry.
>>
>>     It works nicely but it takes a long time and I have 1000 files to 
>> download. Then when I try to do this in Akka, my head spins. First, Akka 
>> discourages passing mutable messages. If I construct the database entry as 
>> a case class, and pass it around, letting other actors completing its 
>> fields, is this a mutable message? Should I avoid it? Second, I found it 
>> was very easy to do sequential programming in Akka framework. You just 
>> construct an actor hierarchy and pass message when the actor is done 
>> processing. However, I in general dislike this sequential construct. So I 
>> came up with this design:
>>
>>              JobDelegator (system actor)     
>>
>> DownloadActor  DatabaseActor  HTTPActor (context actor that gets 
>> constructed under JobDelegator)
>>
>>     So now I feel a little bit more comfortable, but still, I didn't 
>> solve the database entry problem, and this tree structure only has one 
>> level, which in the case of fault tolerance, it's very low. 
>>
>>     How do people solve the insertion to the database (transaction) 
>> problem in Akka? How should I design this simple program?
>>
>> -- 
>> >>>>>>>>>> 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] <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/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