Hi Patrik,

  My fault, I do have one instance of ActorA that has a duplicate 
persistence id as another instance of ActorB. Sorry about that.

  Without persistence, the only requirement is entity id should be unique 
within each shard region, with persistence the requirement is persistence 
id should be unique across all the shard regions. My question is would it 
better to keep the same programming model with/without persistence? What's 
the reason not just to have persistence id only unique within the context 
of a shard region?

  Thanks
  Qing

On Tuesday, February 7, 2017 at 9:00:26 AM UTC-8, Patrik Nordwall wrote:
>
> I don't know without seeing more code.
>
> On Tue, Feb 7, 2017 at 5:57 PM, Qing Zheng <[email protected] 
> <javascript:>> wrote:
>
>> Yes, the persistence IDs are unique for each persistence instance. 
>> Anything else you think I am missing?
>>
>> Thanks for the quick response.
>>
>> Qing
>>
>> On Tuesday, February 7, 2017 at 1:26:45 AM UTC-8, Patrik Nordwall wrote:
>>>
>>> How have you defined the persistenceId in ActorA and ActorB? It must be 
>>> unique for each persistent actor instance.
>>>
>>> On Tue, Feb 7, 2017 at 8:39 AM, Qing Zheng <[email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>>    I have two actor types
>>>>
>>>>    
>>>> class ActorA  extends UntypedPersistentActor {
>>>>   //....
>>>> }
>>>>
>>>>
>>>> class ActorB extends  UntypedPersistentActor {
>>>>   //....
>>>> }
>>>>
>>>> public static void main(String[] argv) {
>>>>   ActorSystem system = ActorSystem.create("ActorSystem", 
>>>> ConfigFactory.load(argv[0]));
>>>>   Persistence.apply(system);
>>>>   ClusterShardingSettings settings = 
>>>> ClusterShardingSettings.create(system);
>>>>   ClusterExtractor extractor = new ClusterExtractor();
>>>>
>>>>   ClusterSharding.get(system).start("ShardRegionA", 
>>>> Props.create(ActorA.class), settings, extractor);
>>>>   ClusterSharding.get(system).start("ShardRegionB", 
>>>> Props.create(ActorB.class), settings, extractor);
>>>>
>>>>   ActorRef shardRegionA = 
>>>> ClusterSharding.get(system).shardRegion("ShardRegionA");
>>>>   ActorRef shardRegionB = 
>>>> ClusterSharding.get(system).shardRegion("ShardRegionB");
>>>>
>>>>   //.....
>>>>
>>>>   Without calling persist.add method everything works as I expected. I 
>>>> can send a cluster message to shard region A or B and ActorA or ActorB 
>>>> will 
>>>> handle the corresponding message differently.However, after invoking the 
>>>> persist.add method. ActorA will receive recovery message for ActorB or 
>>>> maybe vice versa. Looks like the cluster messages that have been persisted 
>>>> do not have the shard region information. How can I solve this problem?
>>>>
>>>>   Thanks
>>>>   Qing
>>>>
>>>> -- 
>>>> >>>>>>>>>> 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.
>>>>
>>>
>>>
>>>
>>> -- 
>>>
>>> Patrik Nordwall
>>> Akka Tech Lead
>>> Lightbend <http://www.lightbend.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] <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.
>>
>
>
>
> -- 
>
> Patrik Nordwall
> Akka Tech Lead
> Lightbend <http://www.lightbend.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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to