How can ff4j client consume the rest api exposed by ff4j server(spring mvc)?

462 Views Asked by At

I have used ff4j-sample-springboot2x-jdbc-postgres and setup my ff4j server along with DB part and exposed the api - accessible at "/api/ff4j". This is my admin component.

Now I want a client microservice (also a springboot app) to consume this REST api and use ff4j.check() and other methods. Is there a quick way (less code - I need to do this for many apps) to consume the api on client-side?

P.S. - For the server I have simply used a DB and ff4j-spring-starter(just like in the sample) - I have not used and jersey/jetty dependencies

1

There are 1 best solutions below

0
On BEST ANSWER

The client accesses the FF4j service using its own FF4j object.

When you create a FF4j object, you define the FeatureStore and PropertyStore that it uses, which determines how the store is accessed. In your case, you want to use a FeatureStoreHttp and PropertyStoreHttp.

String ff4jApiEndPoint = "https://my-ff4j-service.org/api/ff4j";
FeatureStoreHttp  fStore = new FeatureStoreHttp(ff4jApiEndPoint);
PropertyStoreHttp pStore = new PropertyStoreHttp(ff4jApiEndPoint);    
FF4j client_ff4j = new FF4j(fStore, pStore);