EventsByTagStage consuming events from different entities

Hello, We have a use case where we have a shared Cassandra event store and two different replicas of same app(Lagom) using it. Our entities/events are using unique names though

App A --> EntityA --> GeneratedEventA
App B --> EntityB --> GeneratedEventB

Now while analyzing the memory footprint of App A, we are also seeing events generated by AppB mainly related to this class

One thing we noticed is events from both App A and App B are landing into same timebucket partition and perhaps that is the reason that same stream is flowing to both App A and App B.

Is there a way to discard cross events in both the apps? Or do we need to separate out our Cassandra store for this use case?

If the entity events AggregateEventTag implementation from the two apps results in the same tag set they’ll all be processed by both apps. You can avoid this by using the variant of AggregateEventTag.sharded[T] with the baseTagName parameter specific to the app.

A bigger question is that of entity duplication. If the tags are colliding they’re most likely events of the same class. The apps had better not be able to generate the same persistence ID values. Should they do so you may end up with two persistent entities sharing the same ID active simultaneously with each likely holding different versions of state. I’d expect persistent entity errors about duplicate event sequence numbers or something of that sort.