spring-projects / spring-statemachine

Spring Statemachine is a framework for application developers to use state machine concepts with Spring.
1.53k stars 599 forks source link

[ssm-data-redis]How to override RedisHash value #1046

Open blackhuman opened 2 years ago

blackhuman commented 2 years ago

When using Spring Statemachine with spring-statemachine-data-redis, I found that the Redis key always "RedisRepositoryStateMachine". After looking into the code, I found the class RedisRepositoryStateMachine was annotated with @RedisHash which is using default "RedisRepositoryStateMachine" as key prefix.

https://github.com/spring-projects/spring-statemachine/blob/3b93d9de0215760550ee4652e188094ef5e35224/spring-statemachine-data/redis/src/main/java/org/springframework/statemachine/data/redis/RedisRepositoryStateMachine.java#L28-L29

Is there any way to override this prefix? I have multiple applications shared the same Redis, they all using the same prefix, which is not very convenient to distinguish between applications.

nnanda2016 commented 1 year ago

Any update on this? @jvalkeal

OksiBlack commented 10 months ago

Have the same question

nnanda2016 commented 10 months ago

I solved this by providing my own POJO and my own persist interceptor. My guess is, SSM team will not provide a solution for this because this is something required by Spring-Data-Redis framework. SSM is limited by SDR.

It is better to close this ticket.