In our domain we have a concept of billable activities that get logged by a user. The modeling is pretty straightforward -- the
User is an aggregate root, with the
Activities being a collection under the user (an activity doesn't make any sense outside a user, and we have rules to enforce at that level).
We're in the process of a redesign and are evaluating a move to CQRS/ES. The modeling above makes sense, but there's another action that happens on the activities that is a challenge: those activities are "sequenced" (just assigned an auto-incrementing integer
SequenceId and eventually get batched for billing, usually based on a date range or as "all activities since
Due to the number of transactions (10K+ users, 20K+ activities per batch) and because we're batching based on properties intrinsic to the activity itself, it doesn't make sense to batch them through the user AR. However, the act of batching an activity does need to be recorded on the activity as it impacts the business rules for a user's actions (e.g. an activity can't be edited if it's been batched).
Now, without CQRS/ES, we just query the activities then batch flip a status property on them. That isn't possible now with the
User AR managing access to those activities. This seems like a candidate for a separate bounded context, but I still am not sure the right way to share the activities between the users and the batches.
This can't be an uncommon use case, so I'm hoping someone out there has tackled it before and can offer some pointers.