JpaSagaStore - saga_entry and association_value_entry tables are empty

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

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

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

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

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

Noted with thanks, Allard.

Thai