https://www.growthbook.io/ logo
g

gentle-morning-2222

02/03/2023, 11:37 PM
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

fresh-football-47124

02/06/2023, 6:30 PM
Hi William
I was hoping our expert on the Java SDK would comment
but she’s flying currently
g

gentle-morning-2222

02/06/2023, 6:31 PM
Well I believe the question is language agnostic
f

fresh-football-47124

02/06/2023, 6:31 PM
the SDKs do not require refetching of the API every time
it caches the list of features
g

gentle-morning-2222

02/06/2023, 6:32 PM
Right, but the
isOn
function only interprets those features correct?
f

fresh-football-47124

02/06/2023, 6:32 PM
yes
g

gentle-morning-2222

02/06/2023, 6:32 PM
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

fresh-football-47124

02/06/2023, 6:32 PM
The fetch happens initially, then all the isOn or getValues use the stored values
g

gentle-morning-2222

02/06/2023, 6:33 PM
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

fresh-football-47124

02/06/2023, 6:33 PM
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

gentle-morning-2222

02/06/2023, 6:34 PM
Is one method generally suggested?
f

fresh-football-47124

02/06/2023, 6:35 PM
they are both fine to use - the proxy server is very cool and allows for realtime flag updates
g

gentle-morning-2222

02/06/2023, 6:35 PM
Can we use the SDK and the proxy server? I havent checked the docs on that matter yet
f

fresh-football-47124

02/06/2023, 6:35 PM
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

gentle-morning-2222

02/06/2023, 6:37 PM
Is that proxy self-hosted or is it another layer you guys manage on top of the actual API
f

fresh-football-47124

02/06/2023, 6:38 PM
It would be self-hosted
its a container image
g

gentle-morning-2222

02/06/2023, 6:39 PM
And for the webhooks, are we talking about the
trackingCallback
that I see in the docs?
f

fresh-football-47124

02/06/2023, 6:39 PM
no
the trakcingCallbacks are for logging experiment exposure to your data source (though usually an event tracker)
g

gentle-morning-2222

02/06/2023, 6:40 PM
Ok. I'll check the 2 solutions. Thank you
f

fresh-football-47124

02/06/2023, 6:40 PM
how long do the Java threads stay around for?
I imagine it’s not long
g

gentle-morning-2222

02/06/2023, 6:41 PM
Yes, indeed if it is not long, it wouldnt be a problem. I will have to check
3 Views