I am looking into the provided CQRS example.
While code is pretty self explanatory, I’m still trying to wrap my head around an issue.
When you add an item:
val entityRef = sharding.entityRefFor(Expense.EntityKey, data.cartId)
Now, the behaviour that I see is that if the entity with the cartId does not exist, it get created and returned by cluster sharding. However, I would like to have a little bit more control over how and/or when an entity is created. Because if I send an ID that is wrong, it will get created nevertheless.
Is my understanding correct ? If not, what I’m getting wrong ? If yes, how do I control entity creation ?