这是我的用例:
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
如何实施我的服务以确保一致性?
我尝试使用 aCassandraReadSide
来维护一个映射 userId 和 organizationId 的表,但该表最终是一致的。我是否需要使用 userId 作为 entityId 创建另一个实体?
在 fun-cqrs 中,有Projection.onEvent允许知道事件何时被投影处理。
请参阅https://groups.google.com/forum/#!topic/lagom-framework/JG71x5W5h7I