N00b question while implementing the GB SDK with J...
# ask-questions
g
N00b question while implementing the GB SDK with Java. Do I have to refetch the features every time I want to evaluate a feature flag in order to have the most up to date value? That would mean that the
isOn
function does not interact with the API whatsoever?
@fresh-football-47124 would you mind helping out on that one?
f
Hi William
I was hoping our expert on the Java SDK would comment
but she’s flying currently
g
Well I believe the question is language agnostic
f
the SDKs do not require refetching of the API every time
it caches the list of features
g
Right, but the
isOn
function only interprets those features correct?
f
yes
g
Therefore, in order to know the current state of the Feature flag, we have to fetch the features from the API?
and then call the
isOn
function
f
The fetch happens initially, then all the isOn or getValues use the stored values
g
right but if I want to have the up to date version of the FF. Let's say I turn it off, then I want my backend to disable the flow that was hidden behind the FF
f
yes, so there are a few ways to handle that
one, use our webhooks to expire/refresh any caches
two, use our proxy server, which does this automatically
g
Is one method generally suggested?
f
they are both fine to use - the proxy server is very cool and allows for realtime flag updates
g
Can we use the SDK and the proxy server? I havent checked the docs on that matter yet
f
yes
you would point your SDKs at the proxy instead of the full GrowthBook instance
since it’s running local to your clients, the API requests will (should) be very fast
g
Is that proxy self-hosted or is it another layer you guys manage on top of the actual API
f
It would be self-hosted
its a container image
g
And for the webhooks, are we talking about the
trackingCallback
that I see in the docs?
f
no
the trakcingCallbacks are for logging experiment exposure to your data source (though usually an event tracker)
g
Ok. I'll check the 2 solutions. Thank you
f
how long do the Java threads stay around for?
I imagine it’s not long
g
Yes, indeed if it is not long, it wouldnt be a problem. I will have to check