1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

feat: complete java example (#8227)

This commit is contained in:
Jaanus Sellin 2024-09-24 09:55:54 +03:00 committed by GitHub
parent fee2143edf
commit 272052c59b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,7 +12,7 @@ dotnet add package Newtonsoft.Json`,
Java: `<dependency>
<groupId>io.getunleash</groupId>
<artifactId>unleash-client-java</artifactId>
<version>Latest version here</version>
<version>LATEST</version>
</dependency>`,
Python: 'pip install UnleashClient',
JavaScript: 'npm install unleash-proxy-client',
@ -95,6 +95,7 @@ var settings = new UnleashSettings()
.instanceId("unleash-onboarding-instance")
.unleashAPI("<YOUR_API_URL>")
.apiKey("<YOUR_API_TOKEN>")
.sendMetricsInterval(5)
.build();
Unleash unleash = new DefaultUnleash(config);`,
@ -218,7 +219,11 @@ export const checkFlagCodeSnippets: Record<SdkName, string> = {
`,
Rust: ``,
'.NET': ``,
Java: ``,
Java: `while (true) {
boolean featureEnabled = unleash.isEnabled("<YOUR_FLAG>");
System.out.println("Feature enabled: " + featureEnabled);
Thread.sleep(1000);
}`,
Python: `while True:
print(client.is_enabled("<YOUR_FLAG>"))
asyncio.run(asyncio.sleep(1))`,