Should I design the import process by creating hundreds of 
ProductPersistentActor (for each product in the CSV file) and keep a state 
(and after a while destroy them all)? Will that fit the actor model?

I really don't want to do any ETL process for this. The importing process 
should go through the domain model which does validation. If a product that 
is read from the CSV file fails the validation it wont be imported. The 
validation happens in the domain model.

On Wednesday, June 24, 2015 at 6:58:38 AM UTC-5, Patrik Nordwall wrote:

> I don't think Akka Persistence and PersistentActor is the right tool for 
> saving the products.
> Sounds like you should use an ordinary database call.
>
> You could use a PersistentActor for generating the product IDs, if that 
> requires persistent state (e.g. a sequence number).
>
> /Patrik
>
> On Sun, Jun 21, 2015 at 12:57 AM, wonderful world <[email protected] 
> <javascript:>> wrote:
>
>> I have a scenario where I load the *products* from a *CSV* file and 
>> persist them. The CSV file has hundreds of products. I have few users who 
>> upload the CSV file from the UI. In my current non-actor system, the *ID 
>> (Primary Key)* is generated by the database. The *ID* is not 
>> auto-generated.
>>
>> I looked at the *PersistentActor* and not sure whether I should use it. 
>> I want to use a single instance of *PersistentActor* to save the product 
>> one by one after reading from the CSV file. I don't use the *ReceiveRecover 
>> *method because this actor does not have a state - it is a pass through 
>> to persist the product.
>>
>> How can I achieve (1) just persist the product without keeping a state 
>> (2) creating a new ID for every product using the *PersistentActor *before 
>> persisting? I don't prefer a GUID or the name of the product as the id. 
>> Neither there is no bar code when the file is imported.
>>
>> Appreciate sharing some ideas.
>>
>>
>>  -- 
>> >>>>>>>>>> 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.
>>
>
>
>
> -- 
>
> Patrik Nordwall
> Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
> Twitter: @patriknw
>
>  

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