diff --git a/docs/sdk/example-apps.md b/docs/sdk/example-apps.md index 362f99a6..83138fd5 100644 --- a/docs/sdk/example-apps.md +++ b/docs/sdk/example-apps.md @@ -18,7 +18,7 @@ Welcome to the Samples & Example Apps page, which showcases example applications | [Go](https://github.com/DevCycleHQ/go-server-sdk) | [Go Reference Docs](/sdk/server-side-sdks/go.md) | | [iOS](https://github.com/devcyclehq/ios-client-sdk) | [iOS Reference Docs](/sdk/client-side-sdks/ios/ios.md) | | [Java (Cloud Bucketing)](https://github.com/DevCycleHQ/java-server-sdk) | [Java (Cloud Bucketing) Reference Docs](/sdk/server-side-sdks/java-cloud.md) | -| [Java (Local Bucketing)](https://github.com/DevCycleHQ/java-server-sdk) | [Java (Local Bucketing) Reference Docs](/sdk/server-side-sdks/java-local.md) | +| [Java (Local Bucketing)](https://github.com/DevCycleHQ/java-server-sdk) | [Java (Local Bucketing) Reference Docs](/sdk/server-side-sdks/java-local/java-local.md) | | [Javascript](https://github.com/DevCycleHQ/js-sdks/tree/main/sdk/js) | [Javascript Reference Docs](/sdk/client-side-sdks/javascript/javascript.md) | | [NodeJS](https://github.com/DevCycleHQ/js-sdks/tree/main/sdk/nodejs) | [NodeJS Reference Docs](/sdk/server-side-sdks/node.md) | | [PHP](https://github.com/DevCycleHQ/php-server-sdk) | [PHP Reference Docs](/sdk/server-side-sdks/php/php.md) | diff --git a/docs/sdk/features/all-features.md b/docs/sdk/features/all-features.md index cad4dbcc..42027756 100644 --- a/docs/sdk/features/all-features.md +++ b/docs/sdk/features/all-features.md @@ -71,6 +71,6 @@ The DevCycle React SDK is built upon the JavaScript SDK. For more details, view ### [• .NET / C# Local SDK](/sdk/server-side-sdks/dotnet-local#getting-all-features) -### [• Java Local SDK](/sdk/server-side-sdks/java-local#getting-all-features) +### [• Java Local SDK](/sdk/server-side-sdks/java-local/java-local-usage#getting-all-features) ### [• Java Cloud SDK](/sdk/server-side-sdks/java-cloud#getting-all-features) \ No newline at end of file diff --git a/docs/sdk/features/all-variables.md b/docs/sdk/features/all-variables.md index 08cd3715..c6796e9e 100644 --- a/docs/sdk/features/all-variables.md +++ b/docs/sdk/features/all-variables.md @@ -71,6 +71,6 @@ The DevCycle React SDK is built upon the JavaScript SDK. For more details, view ### [• .NET / C# Local SDK](/sdk/server-side-sdks/dotnet-local#getting-all-variables) -### [• Java Local SDK](/sdk/server-side-sdks/java-local#getting-all-variables) +### [• Java Local SDK](/sdk/server-side-sdks/java-local/java-local-usage#getting-all-variables) ### [• Java Cloud SDK](/sdk/server-side-sdks/java-cloud#getting-all-variables) diff --git a/docs/sdk/features/evaluating.md b/docs/sdk/features/evaluating.md index cea15a56..5b34a9c9 100644 --- a/docs/sdk/features/evaluating.md +++ b/docs/sdk/features/evaluating.md @@ -39,6 +39,6 @@ If there is an error reaching DevCycle, if the requested variable does not exist ### [• PHP SDK](/sdk/server-side-sdks/php/php-usage#get-and-use-variable-by-key) -### [• Java Local SDK](/sdk/server-side-sdks/java-local#get-and-use-variable-by-key) +### [• Java Local SDK](/sdk/server-side-sdks/java-local/java-local-usage#get-and-use-variable-by-key) ### [• Java Cloud SDK](/sdk/server-side-sdks/java-cloud#get-and-use-variable-by-key) \ No newline at end of file diff --git a/docs/sdk/features/identify.md b/docs/sdk/features/identify.md index 0bdd05f2..bd2e19ca 100644 --- a/docs/sdk/features/identify.md +++ b/docs/sdk/features/identify.md @@ -101,7 +101,7 @@ As well, unlike the Client-Side SDKs, because Server-Side SDKs poll for project ### [• PHP SDK](/sdk/server-side-sdks/php/php-usage#user-object) -### [• Java Local SDK](/sdk/server-side-sdks/java-local#user-object) +### [• Java Local SDK](/sdk/server-side-sdks/java-local/java-local-usage#user-object) ### [• Java Cloud SDK](/sdk/server-side-sdks/java-cloud#user-object) diff --git a/docs/sdk/features/initialization.md b/docs/sdk/features/initialization.md index 3f2fe431..8e0aa1d4 100644 --- a/docs/sdk/features/initialization.md +++ b/docs/sdk/features/initialization.md @@ -49,7 +49,7 @@ If a variable is first read from the cache and has a listener for [realtime upda ### [• PHP SDK](/sdk/server-side-sdks/php/php-install) -### [• Java Local SDK](/sdk/server-side-sdks/java-local#installation) +### [• Java Local SDK](/sdk/server-side-sdks/java-local/java-local-gettingstarted) ### [• Java Cloud SDK](/sdk/server-side-sdks/java-cloud#installation) diff --git a/docs/sdk/features/track.md b/docs/sdk/features/track.md index c9d6b5a7..52e6cc90 100644 --- a/docs/sdk/features/track.md +++ b/docs/sdk/features/track.md @@ -43,7 +43,7 @@ The Track function in the DevCycle SDKs allows you to send up custom events whic ### [• PHP SDK](/sdk/server-side-sdks/php/php-usage#track-event) -### [• Java Local SDK](/sdk/server-side-sdks/java-local#track-event) +### [• Java Local SDK](/sdk/server-side-sdks/java-local/java-local-usage#track-event) ### [• Java Cloud SDK](/sdk/server-side-sdks/java-cloud#track-event) diff --git a/docs/sdk/server-side-sdks/java-local/_category_.yml b/docs/sdk/server-side-sdks/java-local/_category_.yml new file mode 100644 index 00000000..c35bb8a8 --- /dev/null +++ b/docs/sdk/server-side-sdks/java-local/_category_.yml @@ -0,0 +1,2 @@ +position: 7 +collapsed: true \ No newline at end of file diff --git a/docs/sdk/server-side-sdks/java-local/java-local-gettingstarted.md b/docs/sdk/server-side-sdks/java-local/java-local-gettingstarted.md new file mode 100644 index 00000000..1b85de4f --- /dev/null +++ b/docs/sdk/server-side-sdks/java-local/java-local-gettingstarted.md @@ -0,0 +1,65 @@ +--- +title: DevCycle Java Local Server SDK Getting Started +sidebar_label: Getting Started +sidebar_position: 2 +--- + +[![Maven](https://badgen.net/maven/v/maven-central/com.devcycle/java-server-sdk)](https://search.maven.org/artifact/com.devcycle/java-server-sdk) +[![GitHub](https://img.shields.io/github/stars/devcyclehq/java-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/java-server-sdk) + + +To use the DevCycle Java SDK, initialize a client object. + +```java +import com.devcycle.sdk.server.local.api.DVCLocalClient; + +public class MyClass { + + private DVCLocalClient dvcLocalClient; + + public MyClass() { + dvcLocalClient = new DVCLocalClient(""); + } +} +``` + +## Initialization Options + +| DVC Option | Description | +| --- | ----------- | +| configPollingIntervalMs | Controls the polling interval in milliseconds to fetch new environment config changes, defaults to 10 seconds, minimum value is 1 second. | +| configRequestTimeoutMs | Controls the request timeout to fetch new environment config changes, defaults to 5 seconds, must be less than the configPollingIntervalMS value, minimum value is 1 second. | +| eventFlushIntervalMS | Controls the interval between flushing events to the DevCycle servers, defaults to 30 seconds. | +| maxEventQueueSize | Controls the maximum number of events in queue, defaults to 2000. | +| eventRequestChunkSize | Controls the size of the number of events per request sent to the DevCycle servers, defaults to 100. | +| configCdnBaseUrl | Controls the endpoint used to fetch the project configurations from the DevCycle CDN, defaults to "https://config-cdn.devcycle.com/". | +| eventsApiBaseUrl | Controls the endpoint used to send events to the DevCycle servers, defaults to "https://events.devcycle.com/". | +| disableAutomaticEventLogging | Disables logging of any automatic events or user data to DevCycle. | +| disableCustomEventLogging | Disables logging of any Custom Events to DevCycle. | + +```java +import com.devcycle.sdk.server.local.api.DVCLocalClient; +import com.devcycle.sdk.server.local.model.DVCLocalOptions; + +public class MyClass { + + private DVCLocalClient dvcLocalClient; + + private DVCLocalOptions dvcLocalOptions = DVCLocalOptions.builder() + .configPollingIntervalMs(60000) + .configRequestTimeoutMs(30000) + .eventFlushIntervalMS(10000) + .flushEventQueueSize(1000) + .maxEventQueueSize(2000) + .eventRequestChunkSize(100) + .configCdnBaseUrl("https://my-custom.config.com/") + .eventsApiBaseUrl("https://my-custom.events.com/") + .disableAutomaticEventLogging(false) + .disableCustomEventLogging(false) + .build(); + + public MyClass() { + dvcLocalClient = new DVCLocalClient("", dvcLocalOptions); + } +} +``` \ No newline at end of file diff --git a/docs/sdk/server-side-sdks/java-local/java-local-install.md b/docs/sdk/server-side-sdks/java-local/java-local-install.md new file mode 100644 index 00000000..9277201e --- /dev/null +++ b/docs/sdk/server-side-sdks/java-local/java-local-install.md @@ -0,0 +1,52 @@ +--- +title: DevCycle Java Local Server SDK Installation +sidebar_label: Installation +sidebar_position: 1 +--- + +[![Maven](https://badgen.net/maven/v/maven-central/com.devcycle/java-server-sdk)](https://search.maven.org/artifact/com.devcycle/java-server-sdk) +[![GitHub](https://img.shields.io/github/stars/devcyclehq/java-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/java-server-sdk) + +## Requirements + +This version of the DevCycle SDK works with Java 8 and above. + +Using the Java SDK library requires [Maven](https://maven.apache.org/) or [Gradle](https://gradle.org/) >= 5.6.4 to be installed. + +:::info + +An x64 JDK is required for Local Bucketing with the DevCycle Java SDK. + +::: + + +## Maven + +You can use the SDK in your Maven project by adding the following to your *pom.xml*: + +```xml + + com.devcycle + java-server-sdk + LATEST + compile + +``` + +:::info + +Refer to the latest version of the SDK on [maven central](https://maven.org/artifact/com.devcycle/android-client-sdk) if you would not prefer Maven or Gradle to pull the latest version automatically by using `+` + +::: + +## Gradle +Alternatively you can use the SDK in your Gradle project by adding the following to *build.gradle*: + +```yaml +implementation("com.devcycle:java-server-sdk:+") +``` + +## DNS Caching +The JVM, by default, caches DNS for infinity. DevCycle servers are load balanced and dynamic. To address this concern, +setting the DNS cache TTL to a short duration is recommended. The TTL is controlled by this security setting `networkaddress.cache.ttl`. +Recommended settings and how to configure them can be found [here](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-jvm-ttl.html). diff --git a/docs/sdk/server-side-sdks/java-local.md b/docs/sdk/server-side-sdks/java-local/java-local-usage.md similarity index 50% rename from docs/sdk/server-side-sdks/java-local.md rename to docs/sdk/server-side-sdks/java-local/java-local-usage.md index e89525f2..460448ec 100644 --- a/docs/sdk/server-side-sdks/java-local.md +++ b/docs/sdk/server-side-sdks/java-local/java-local-usage.md @@ -1,123 +1,14 @@ --- -title: Java SDK for Local Bucketing -sidebar_position: 7 +title: DevCycle Java Cloud Server SDK Usage +sidebar_label: Usage +sidebar_position: 3 --- -# DevCycle Java Server SDK - -Welcome to the DevCycle Java SDK, which interfaces with the [DevCycle Bucketing API](/bucketing-api/#tag/devcycle). - -The SDK is available as a package on MavenCentral. It is also open source and can be viewed on Github. - [![Maven](https://badgen.net/maven/v/maven-central/com.devcycle/java-server-sdk)](https://search.maven.org/artifact/com.devcycle/java-server-sdk) [![GitHub](https://img.shields.io/github/stars/devcyclehq/java-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/java-server-sdk) -## Requirements - -This version of the DevCycle SDK works with Java 8 and above. - -Using the Java SDK library requires [Maven](https://maven.apache.org/) or [Gradle](https://gradle.org/) >= 5.6.4 to be installed. - -:::info - -An x64 JDK is required for Local Bucketing with the DevCycle Java SDK. - -::: - -## Installation - -### Maven - -You can use the SDK in your Maven project by adding the following to your *pom.xml*: - -```xml - - com.devcycle - java-server-sdk - LATEST - compile - -``` - -:::info - -Refer to the latest version of the SDK on [maven central](https://maven.org/artifact/com.devcycle/android-client-sdk) if you would not prefer Maven or Gradle to pull the latest version automatically by using `+` - -::: - -### Gradle -Alternatively you can use the SDK in your Gradle project by adding the following to *build.gradle*: - -```yaml -implementation("com.devcycle:java-server-sdk:+") -``` - -## DNS Caching -The JVM, by default, caches DNS for infinity. DevCycle servers are load balanced and dynamic. To address this concern, -setting the DNS cache TTL to a short duration is recommended. The TTL is controlled by this security setting `networkaddress.cache.ttl`. -Recommended settings and how to configure them can be found [here](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-jvm-ttl.html). - -## Getting Started - -To use the DevCycle Java SDK, initialize a client object. - -```java -import com.devcycle.sdk.server.local.api.DVCLocalClient; - -public class MyClass { - - private DVCLocalClient dvcLocalClient; - - public MyClass() { - dvcLocalClient = new DVCLocalClient(""); - } -} -``` - -### Initialization Options - -| DVC Option | Description | -| --- | ----------- | -| configPollingIntervalMs | Controls the polling interval in milliseconds to fetch new environment config changes, defaults to 10 seconds, minimum value is 1 second. | -| configRequestTimeoutMs | Controls the request timeout to fetch new environment config changes, defaults to 5 seconds, must be less than the configPollingIntervalMS value, minimum value is 1 second. | -| eventFlushIntervalMS | Controls the interval between flushing events to the DevCycle servers, defaults to 30 seconds. | -| maxEventQueueSize | Controls the maximum number of events in queue, defaults to 2000. | -| eventRequestChunkSize | Controls the size of the number of events per request sent to the DevCycle servers, defaults to 100. | -| configCdnBaseUrl | Controls the endpoint used to fetch the project configurations from the DevCycle CDN, defaults to "https://config-cdn.devcycle.com/". | -| eventsApiBaseUrl | Controls the endpoint used to send events to the DevCycle servers, defaults to "https://events.devcycle.com/". | -| disableAutomaticEventLogging | Disables logging of any automatic events or user data to DevCycle. | -| disableCustomEventLogging | Disables logging of any Custom Events to DevCycle. | - -```java -import com.devcycle.sdk.server.local.api.DVCLocalClient; -import com.devcycle.sdk.server.local.model.DVCLocalOptions; - -public class MyClass { - - private DVCLocalClient dvcLocalClient; - - private DVCLocalOptions dvcLocalOptions = DVCLocalOptions.builder() - .configPollingIntervalMs(60000) - .configRequestTimeoutMs(30000) - .eventFlushIntervalMS(10000) - .flushEventQueueSize(1000) - .maxEventQueueSize(2000) - .eventRequestChunkSize(100) - .configCdnBaseUrl("https://my-custom.config.com/") - .eventsApiBaseUrl("https://my-custom.events.com/") - .disableAutomaticEventLogging(false) - .disableCustomEventLogging(false) - .build(); - - public MyClass() { - dvcLocalClient = new DVCLocalClient("", dvcLocalOptions); - } -} -``` - -## Usage -### User Object +## User Object The user object is required for all methods. The only required field in the user object is userId. See the User class in [Java User model doc](https://github.com/DevCycleHQ/java-server-sdk/blob/main/docs/User.md) for all accepted fields. @@ -128,7 +19,7 @@ User user = User.builder() .build(); ``` -### Getting All Features +## Getting All Features This method will fetch all features for a given user and return them as Map<String, Feature>. If the project configuration is unavailable, this will return an empty map. ```java @@ -155,7 +46,7 @@ public class MyClass { } ``` -### Getting All Variables +## Getting All Variables This method will fetch all variables for a given user and returned as Map<String, Feature>. If the project configuration is unavailable, this will return an empty map. To get values from your Variables, the `value` field inside the variable object can be accessed. @@ -184,7 +75,7 @@ public class MyClass { } ``` -### Get and Use Variable By Key +## Get and Use Variable By Key This method will fetch a specific variable by key for a given user. The default variable will be used in cases where the user is not segmented into a feature using that variable, or the project configuration is unavailable to be fetched from DevCycle's CDN. @@ -224,7 +115,7 @@ public class MyClass { } ``` -### Track Event +## Track Event To POST custom event for a user, pass in the user and event object. @@ -259,7 +150,7 @@ public class MyClass { } ``` -### EdgeDB +## EdgeDB :::caution diff --git a/docs/sdk/server-side-sdks/java-local/java-local.md b/docs/sdk/server-side-sdks/java-local/java-local.md new file mode 100644 index 00000000..042f8e9a --- /dev/null +++ b/docs/sdk/server-side-sdks/java-local/java-local.md @@ -0,0 +1,10 @@ +--- +title: Java SDK for Local Bucketing +--- + +Welcome to the DevCycle Java SDK, which interfaces with the [DevCycle Bucketing API](/bucketing-api/#tag/devcycle). + +The SDK is available as a package on MavenCentral. It is also open source and can be viewed on Github. + +[![Maven](https://badgen.net/maven/v/maven-central/com.devcycle/java-server-sdk)](https://search.maven.org/artifact/com.devcycle/java-server-sdk) +[![GitHub](https://img.shields.io/github/stars/devcyclehq/java-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/java-server-sdk)