Thank you

понеділок, 25 вересня 2017 р. 21:36:08 UTC+3 користувач Justin du coeur 
написав:
>
> Sure, but I think you're thinking about it incorrectly.  Don't worry about 
> creating the Sharding entity itself, which has no lasting effect -- 
> instead, focus on not *persisting* anything unless the wallet is already 
> valid.  The preStart idea isn't bad, but probably expensive (assuming the 
> external DB is a bit expensive, which is typically true), so you don't want 
> to *always* check it, just when the wallet is new.
>
> Instead, I would send a message to the wallet, which causes the wallet 
> entity to be created and to "recover".  Recovery finds that there is no 
> history for the wallet, so post-recovery the actor checks the external DB.  
> If it finds that the wallet has been created, great -- it persists an event 
> that says so.  Otherwise it returns a message saying "this wallet doesn't 
> exist yet", and kills itself.
>
> On Mon, Sep 25, 2017 at 9:47 AM, Evgeny Shepelyuk <[email protected] 
> <javascript:>> wrote:
>
>> Hello
>>
>> I'd like to implement cluster sharding enabled service with following 
>> scenario
>>
>> # *Wallet *service manages users' wallets
>> # Each *wallet* is represented as persistent actors / shard entity
>> # Shard clients are sending deposit / withdraw commands to wallets
>> # Wallet creation is a dedicated business procedure and can't be just a 
>> creating new actor by *ShardRegion *actor
>>  
>> What we're trying to achieve is 
>>
>> # before processing deposit / withdraw commands to check if some external 
>> DB contains record about *wallet *registration
>> # create shard entity only if *wallet *is registered before
>>
>> Is this a valid scenario for akka cluster sharding and if yes - how can 
>> this be achieved ?
>>
>> Unfortunately haven't find proper information in Internet., the only 
>> option I see now - is to check external DB in preStart method of shard 
>> entity.
>>
>>
>>
>> -- 
>> >>>>>>>>>> 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 https://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 [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