Projection to aggregage events by mask/wildcard?

I am trying to create one stream that will combine all events for one aggregate, eg Order. So event types would be like OrderCreated, OrderLineAdded, OrderDeliveryAddressChanged and so on.

Is if possible to avoid having "when: " for each individual event type and have something like when: “Order*” instead?

Why not just read the aggregate’s associated stream? I’d presume you partition streams by aggregate in most cases.

Yes, the recommended approach here would be stream per aggregate. If you need to read combined streams you could use the category projections etc.

FWIW, the answer to the question is yes you can do that:



$any: function(state, event) {

​//do whatever



In the domain event sourcing I of course have one stream per aggregate. I use Yver’ AggregageSource with James’ AS.ES repository implementation (with some changes).

The scenario that I need is to integrate with external systems. They need to be informed about all changes in particular aggregate, like all Order events or all Customer events.

I believe, James’ answer covers that.