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

When using reactive sagas, the data is not persisted as expected #99

Open
rrrship opened this issue Jan 3, 2024 · 2 comments
Open

When using reactive sagas, the data is not persisted as expected #99

rrrship opened this issue Jan 3, 2024 · 2 comments

Comments

@rrrship
Copy link

rrrship commented Jan 3, 2024

I'm not sure if this is intentional or not, but with non-reactive sagas we're able to update the saga data in the reply handlers and it gets persisted automatically. Right now this doesn't seem to be the case with reactive approach, unless I'm doing something totally wrong myself? I've created an example of this issue in my fork repo: link to repo.

In this example both of these tests throw NPEs when trying to assert the data. These same validations are successful with non-reactive approach.

@rrrship
Copy link
Author

rrrship commented Jan 4, 2024

Actually I found out one issue with my tests. I will try to make a new test case.

@rrrship rrrship closed this as completed Jan 4, 2024
@rrrship rrrship reopened this Jan 4, 2024
@rrrship
Copy link
Author

rrrship commented Jan 4, 2024

Here is the updated version with the class which has the failing tests in my fork.

I looked around a little bit in the code and I noticed one difference between reactive and non-reactive, and it's in the ReactiveSagaManagerImpl.java file, line 182. There the data variable is passed to handleReply method, but it's coming from getSagaData(si) method call, while the data variable is also initialized separately on line 180. When I change line 182 to this, then these tests actually pass:
Mono<SagaActions<Data>> actions = Mono.from(getStateDefinition().handleReply(sagaType, sagaId, currentState, data, message));

I'm wondering though if there might be some reason for doing it like this or it's a bug, @cer

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