ff4j icon indicating copy to clipboard operation
ff4j copied to clipboard

Feature/PropertyStore implementation using RedisHash?

Open jtrenaud1s opened this issue 2 years ago • 1 comments

I'm working to get ff4j working with spring boot, and have had success using the ff4j-store-redis implementation, but it was suggested that I try and use RedisHash annotation provided by spring-data-redis to establish the redis connection and manage feature entities. How difficult would this be to re-implement?

I can't exactly add the @RedisHash annotation to the Feature class, and I have no idea if subclassing it and applying the annotation will work the way I expect. I'm also not sure how I'd re-implement the feature and property stores using CrudRepositories considering the relationship between Feature and Property, how they're handled separately and mapped together by ff4j.

jtrenaud1s avatar Jan 19 '23 20:01 jtrenaud1s

RedisHash is a different way to store data in redis. To have it working with spring-data-redis here are the different operations to do:

  • Create FeatureStore, PropertyStore and AuditRepository classes same as the one you can see here.
  • Create dedicated beans associated to Feature, Property and Event, annotated with @RedisHash. The repository spring data repository would work with the annotated bean and then manual mapping would recreate public Feature, Property and Event.
  • You do not want to change and subclasses the objects in public interfaces as they are used everywhere including API and Http clients.

I think those classes could be part of the ff4j-store-redis. We would reviewed a pull request in that direction but will not implement it.

clun avatar Feb 07 '23 09:02 clun