Thai_Ngo
(Thai Ngo)
May 11, 2019, 2:40pm
1
Hi everyone,
I have been doing a POC using Axon and everything works very well. However when I switched to JpaSagaStore as per below bean configuration, I am seeing that there is no entry in those 2 tables
@Bean
public SagaStore mySagaStore(EntityManagerProvider provider, Serializer serializer) {
return JpaSagaStore.builder().entityManagerProvider(provider).serializer(serializer).build();
}
It’s quite strange that I have no issue using JpaTokenStore as below bean configuration and the POC is able to saved token into token entry:
@Bean
public TokenStore tokenStore(EntityManagerProvider entityManagerProvider) {
return JpaTokenStore.builder().entityManagerProvider(entityManagerProvider).serializer(eventSerializer()).build();
}
I am using:
axon-spring-boot-starter and Axon Server 4.1.1
PostgreSQL database
Could anyone help me on this?
Thanks,
Thai
Thai_Ngo
(Thai Ngo)
May 12, 2019, 2:43am
2
Hi,
I just tested an unhappy case for the Saga and found that its respective data is actually stored in those tables. I wonder if it is the normal behavior for Saga. Could you please confirm that? My expectation is all data for the Saga should be persisted regardless of its failure.
Thanks,
Thai
allardbz
(Allard Buijze)
May 12, 2019, 5:15am
3
Hello Thai,
in the ‘happy case’, did you end the Saga lifecycle? The SagaStore only stores active Sagas. Once they’re ended, their entry is removed.
Cheers,
Allard
Thai_Ngo
(Thai Ngo)
May 13, 2019, 3:26pm
4
Hi Allard,
Thanks for your input. Yes I did end the Saga lifecycle.
To clarify further: what do you mean by ‘active Sagas’? How would I get the ended Sagas?
Thanks,
Thai
allardbz
(Allard Buijze)
May 14, 2019, 10:15am
5
When the Saga is ended, its entry is removed from the Saga store.
So it’s actually correct that you don’t see any instances in the store in this case.
With ‘active saga’ I basically mean all Sagas that have not been ended.
Cheers,
Allard
Thai_Ngo
(Thai Ngo)
May 17, 2019, 12:58pm
6
Noted with thanks, Allard.
Thai