FF4J: REST endpoint as a feature store

2.5k Views Asked by At

I am currently looking at implementing feature toggles using ff4j for our application. We want to have a remote central config app which will hold all the features in it and the applications will talk to this central config app via REST to get the features. We will not be able to leverage Spring Cloud Config or Archaius for this purpose.

I went through the documentation and it seems there is a support for HttpClient (https://github.com/ff4j/ff4j/wiki/Store-Technologies#httpclient). But I couldn't find any sample for the same. Can someone please let me know if I can leverage this method to build my feature store from a REST endpoint. Also, I would appreciate if someone could point me to a sample of this.

1

There are 1 best solutions below

4
On BEST ANSWER

This is a common pattern.

  1. A component holds the Administration UI (console) and the REST API. You can call it the "Admin Component". For security reasons It may be the only component to have access to persistance unit (any of the 15 DB implementation available)

For the "admin component" HERE is sample using standAlone spring-bppt application using JDBC DB, and HERE you find a simple web application.

The REST API can be secured using credentials user/password and/or API Key. More information HERE

  1. All microservices access the REST API as clients and request feature store. You will need the dependency ff4j-webapi-jersey2x or ff4j-webapi-jersey1x that hold the client http> Then you can define the store using :

    FeatureStoreHttp storeHTT = new FeatureStoreHttp("http://localhost:9998/ff4j");

Warning : Please consider using cache to limit overhead introduce by accessing the REST API at each feature usage. More info on cache HERE