ecotoneframework / ecotone-dev

Ecotone Framework Development - This is Monorepo which contains all official public modules
https://docs.ecotone.tech
Other
37 stars 16 forks source link

Synchronous event handlers order or priority #325

Closed lifinsky closed 2 months ago

lifinsky commented 3 months ago

Description
Currently, event handler priority works only for asynchronous event handlers. However, to ensure that, for example, one of the projections is processed first, it is necessary to have the ability to prioritize the event handler.

lifinsky commented 3 months ago

There is an event-sourcing transaction aggregate and an event-sourcing customer balance aggregate. To create a projection of fund movements on the balance, we need up-to-date transaction data. Ideally, to avoid using event handler prioritization, it would be great to guarantee that the synchronous projection is executed immediately after the event is saved to its aggregate in the event store, and only after that, the event is listened to by another aggregate.

dgafka commented 3 months ago

Hey @lifinsky,

Yep, priority does work only for async, but I don't see reason why wouldn't it work for sync scenarios too. I will see what we can do with it when I will have some free time :)

dgafka commented 2 months ago

This feature is now added https://github.com/ecotoneframework/ecotone-dev/releases/tag/1.223.0