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

Allows replayStatus to be checked in event handlers #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

macsux
Copy link

@macsux macsux commented Apr 29, 2019

No description provided.

@dasiths
Copy link
Owner

dasiths commented Apr 30, 2019

Hi @macsux,
Do you mind giving a quick rundown of a scenario where this would be useful? Are you doing any external (api/io) calls from the internal event handler?

@macsux
Copy link
Author

macsux commented Apr 30, 2019 via email

@dasiths
Copy link
Owner

dasiths commented Apr 30, 2019

I'm having a bit of trouble understanding this. Sorry. Are you using the aggregate to build the saga? I like to understand the scenario a bit better. Do you have an example I can have a look at?

With the triggering of additional commands. There is a caveat here.
Internal event handler shouldn't be creating more commands. Only external event handlers should do so. So when replaying (or loading from db) those external handler's don't get triggered at all.

Copy link
Owner

@dasiths dasiths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ReplayStatus should not be required for internal event handlers and they shouldn't care about whether it's the replay or not. External event handlers should only be called once by the framework anyway.

If you want to implement the feature anyway I would consider an AsyncLocal<EventContext> (Inside the Aggregate) to capture this type of ambient information and act accordingly.

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

Successfully merging this pull request may close these issues.

2 participants