Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

[EventsSubscription] Fix transaction scope in EventsSubscription #360

@hkawalek

Description

@hkawalek

Problem description

When EventsSubscription processes event, it begins new transaction and then starts executing registered onEvent
callbacks. Then sample onEvent callback publishes command which starts flow CommandHandler -> ApplicationService -> EventRepository.read -> DomainLogic -> EventRepository.write -> EventBus. During EventRepository.write step, the new different transaction begins and commits successfully. If after this transaction next onEvent throws error, the transaction which was started by EventsSubscription is aborted but the changes made by EventRepository.write heve already been persisted. Consequently EventsSubscription is in inconsistent state because currentPosition hasn't changed but some changes of onEvent occured.

Solution

EventRepository.write executed by onEvent callback should use transaction started in EventsSubscription.

Summon: @nowakprojects

Metadata

Metadata

Assignees

Labels

priority: criticalUsers are blocked. Fix it as soon as possiblescope: 🛰 apiRequires changes in the api workspacetype: 🐛 fixSomething isn't working. We specified it's importance with a priority label

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions