Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ if (inited) {
`startWaitTime`: how long the constructor will block awaiting a successful data sync. Setting this to a zero or negative
duration will not block and cause the constructor to return immediately.

`offline`: Set whether SDK is offline. when set to true no connection to your feature management platform anymore
`offline`: Set whether SDK is offline. when set to **true** no connection to your feature management platform anymore

`disableEvents`: Set whether disable to send events. when set to **true** no sending any events to your feature management platform

Here is an example of creating a client with default configurations:

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>co.featbit</groupId>
<artifactId>featbit-java-sdk</artifactId>
<version>1.4.2</version>
<version>1.4.3</version>

<name>featbit/featbit-java-sdk</name>

Expand Down
22 changes: 21 additions & 1 deletion src/main/java/co/featbit/server/FBConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class FBConfig {

private boolean offline;
private Duration startWaitTime;
private boolean disableEvents;

private String streamingURL;

Expand Down Expand Up @@ -59,10 +60,15 @@ public String getEventURL() {
return eventURL;
}

public boolean isDisableEvents() {
return disableEvents;
}

public FBConfig(Builder builder) {
this.offline = builder.offline;
this.streamingURL = builder.streamingURL;
this.eventURL = builder.eventURL;
this.disableEvents = builder.disableEvents;
this.startWaitTime = builder.startWaitTime == null ? DEFAULT_START_WAIT_TIME : builder.startWaitTime;
if (builder.offline) {
Loggers.CLIENT.info("FB JAVA SDK: SDK is in offline mode");
Expand All @@ -72,7 +78,7 @@ public FBConfig(Builder builder) {
this.dataSynchronizerFactory =
builder.dataSynchronizerFactory == null ? Factory.dataSynchronizerFactory() : builder.dataSynchronizerFactory;
this.insightProcessorFactory =
builder.insightProcessorFactory == null ? Factory.insightProcessorFactory() : builder.insightProcessorFactory;
builder.insightProcessorFactory == null ? (this.disableEvents ? Factory.externalEventTrack() : Factory.insightProcessorFactory()) : builder.insightProcessorFactory;
}
this.dataStorageFactory =
builder.dataStorageFactory == null ? Factory.inMemoryDataStorageFactory() : builder.dataStorageFactory;
Expand All @@ -88,6 +94,7 @@ public FBConfig(Builder builder) {
* .eventURL("your event URI")
* .startWaitTime(Duration.ZERO)
* .offline(false)
* .disableEvents(false)
* .build()
* </code></pre>
*/
Expand All @@ -99,6 +106,8 @@ public static class Builder {
private InsightProcessorFactory insightProcessorFactory;
private Duration startWaitTime;
private boolean offline = false;
private boolean disableEvents = false;


private String streamingURL;

Expand Down Expand Up @@ -206,6 +215,17 @@ public Builder eventURL(String eventURL) {
return this;
}

/**
* Set whether disable to send events
*
* @param disableEvents
* @return the builder
*/
public Builder disableEvents(boolean disableEvents) {
this.disableEvents = disableEvents;
return this;
}

/**
* Builds the configured {@link FBConfig}
*
Expand Down
Loading