Here is my use case:
case class Organization(id: String = UUID.randomUUID().toString, userId: String)
case class OrganizationState(organization: Option[Organization])
case CreateOrganization extends OrganizationCommand
case OrganizationCreated extends OrganizationEvent
class OrganizationEntity extends PersistentEntity[OrganizationCommand, OrganizationEvent, OrganizationState]
POST /organizations?userId=1 <= creates an organization associated with user 1
GET /organizations?userId=1 <= retrieves all organizations associated with user 1
How can I implement my service in order to insure consistency ?
I try using a CassandraReadSide
to maintain a table mapping userId with organizationId but this table is eventually consistent.
Do I need to create another Entity with the userId as entityId ?
In fun-cqrs, there is the Projection.onEvent that allows to know when an event was processed by a projection.
See https://groups.google.com/forum/#!topic/lagom-framework/JG71x5W5h7I