I don't know that we're going to agree here, but I *do* strongly disagree.
They're independent libraries, and people use each exclusively of the
other.  There mustn't be cross-dependencies.

And I have to admit, I don't understand what the problem is.  I simply use
a different naming convention for each Cluster Region, and that's no more
work than choosing a different prefix.  What's the big deal?

On Thu, Feb 9, 2017 at 12:47 PM, Qing Zheng <qzhen...@gmail.com> wrote:

> I disagree, you have all the pieces of your system, however, they are not
> fit well with each other at least that's how I feel from a user point of
> view. Just like you have database tableA and tableB, the ID in tableA has
> nothing to do with ID in tableB. This may not be a good analogy, but you
> get the idea. I agree with you at the lower level of akka persistence
> (journal/snapshot) it should have no knowledge of sharding at all.However,
> in the akka persistence base actor class it should take care of this.
> Otherwise every user has to come up with its own scheme to make persistence
> id unique across all actor classes. It would be nice to provide a default
> implementation in the base class and a user can customize it. The default
> implementation  can simply encode the actor class info together with some
> unique instance id within that class.
>
>   Thanks
>   Qing
>
> On Thursday, February 9, 2017 at 5:42:25 AM UTC-8, Justin du coeur wrote:
>>
>> Persistence and sharding are separate systems -- while they work well
>> together, neither depends upon the other.  So it would be inappropriate for
>> persistence to depend on knowledge of which sharding region an Actor is
>> in...
>>
>> On Wed, Feb 8, 2017 at 11:54 AM, Qing Zheng <qzhe...@gmail.com> wrote:
>>
>>> 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 <qzhe...@gmail.com> 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 <qzhe...@gmail.com> 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).sh
>>>>>>> ardRegion("ShardRegionA");
>>>>>>>   ActorRef shardRegionB = ClusterSharding.get(system).sh
>>>>>>> ardRegion("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/c
>>>>>>> urrent/additional/faq.html
>>>>>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>>>>>> p/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 akka-user+...@googlegroups.com.
>>>>>>> To post to this group, send email to akka...@googlegroups.com.
>>>>>>> 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/c
>>>>> urrent/additional/faq.html
>>>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>>>> p/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 akka-user+...@googlegroups.com.
>>>>> To post to this group, send email to akka...@googlegroups.com.
>>>>> 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/c
>>> urrent/additional/faq.html
>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>> p/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 akka-user+...@googlegroups.com.
>>> To post to this group, send email to akka...@googlegroups.com.
>>> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> 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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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