Skip to main content

Java Server SDK Getting Started

Maven GitHub

To use the DevCycle Java SDK, initialize a client object.

import com.devcycle.sdk.server.local.api.DevCycleLocalClient;

public class MyClass {

private DevCycleLocalClient client;

public MyClass() {
client = new DevCycleLocalClient("<DEVCYCLE_SERVER_SDK_KEY>");
}
}

NOTE: use DevCycleCloudClient for Cloud Bucketing mode.

Initialization Options

DevCycleLocalOptionsDescription
enableEdgeDBEnables the usage of EdgeDB for DevCycle that syncs User Data to DevCycle.
NOTE: This is only available with Cloud Bucketing.
configPollingIntervalMsControls the polling interval in milliseconds to fetch new environment config changes, defaults to 10 seconds, minimum value is 1 second.
configRequestTimeoutMsControls 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.
eventFlushIntervalMSControls the interval between flushing events to the DevCycle servers, defaults to 30 seconds.
maxEventQueueSizeControls the maximum number of events in queue, defaults to 2000.
eventRequestChunkSizeControls the size of the number of events per request sent to the DevCycle servers, defaults to 100.
configCdnBaseUrlControls the endpoint used to fetch the project configurations from the DevCycle CDN, defaults to "https://config-cdn.devcycle.com/".
eventsApiBaseUrlControls the endpoint used to send events to the DevCycle servers, defaults to "https://events.devcycle.com/".
disableAutomaticEventLoggingDisables logging of any automatic events or user data to DevCycle.
disableCustomEventLoggingDisables logging of any Custom Events to DevCycle.
import com.devcycle.sdk.server.local.api.DevCycleLocalClient;
import com.devcycle.sdk.server.local.model.DevCycleLocalOptions;

public class MyClass {

private DevCycleLocalClient client;

public MyClass() {
DevCycleLocalOptions options = DevCycleLocalOptions.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();

client = new DevCycleLocalClient("<DEVCYCLE_SERVER_SDK_KEY>", options);
}
}

NOTE: use DevCycleCloudOptions \ DevCycleCloudClient for Cloud Bucketing mode.