Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Core.Marten.Repository.MartenRepository.Store & Ambiente Transactions #80

Open
soernt opened this issue Oct 31, 2021 · 0 comments

Comments

@soernt
Copy link

soernt commented Oct 31, 2021

Hi there,

the Core.Marten.Repository.MartenRepository.Store is implemented as following:

        private async Task Store(T aggregate, CancellationToken cancellationToken)
        {
            var events = aggregate.DequeueUncommittedEvents();
            documentSession.Events.Append(
                aggregate.Id,
                events
            );
            await documentSession.SaveChangesAsync(cancellationToken);
            await eventBus.Publish(events);
        }

The uncommitted events are saved and published.
If a subscriber in turn also needs to save its modified aggregate and that operations fails for some reason, we ended up with some inconsistencies.

Is there an option to check if there is an ambiente transaction active and when not to explicit start one before saving and committing it after publishing the events?

I think that is somehow related to your open task Add sample outbox pattern implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant