Hi!

How do you generate your persistenceIds?
One common approach is UUID.randomUUID().toString(). But in my opinion it 
could be worth it to choose a smarter generation strategy.
Some use cases based on key segments are:

   - Akka cluster sharding
   - NoSQL DB sharding
   - Lexicographical order of PK in (query model) RDBMS indexes (see Why 
   GUID primary keys are a database’s worst nightmare 
   
<http://csharptest.net/1250/why-guid-primary-keys-are-a-databases-worst-nightmare/>
   )
   - Creation of topics in event logs (e.g. Kafka)
   - More convenient preselection in processing of event logs (e.g. by akka 
   streams, Spark)
   - Routing of messages in the actor hierarchy.

MongoDB has e.g. this ObjectId 
<http://docs.mongodb.org/manual/reference/object-id/>. (not very useful for 
the above examples)
And in the book IDDD by *Vaughn Vernon* I've found this example for an 
unique entity identity:

   - Bounded context name (abbreviation)
   - Entity name (abbreviation)
   - Creation date
   - First segment of a random UUID

A variation of this could also include a tenant id or a creation time.
On the other hand the persistenceId shouldn't be too long, because it will 
be in every single event in the log (and other places).

What do you think? What information is most valuable to be encoded in the 
persistenceId 
for future use?

Best regards
Sebastian

-- 
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to