diff --git a/README.md b/README.md index 5cf8ee5..9f2234a 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/pom.xml b/pom.xml index 07557b2..f02ca89 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ co.featbit featbit-java-sdk - 1.4.2 + 1.4.3 featbit/featbit-java-sdk diff --git a/src/main/java/co/featbit/server/FBConfig.java b/src/main/java/co/featbit/server/FBConfig.java index af81914..ecdb134 100644 --- a/src/main/java/co/featbit/server/FBConfig.java +++ b/src/main/java/co/featbit/server/FBConfig.java @@ -18,6 +18,7 @@ public class FBConfig { private boolean offline; private Duration startWaitTime; + private boolean disableEvents; private String streamingURL; @@ -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"); @@ -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; @@ -88,6 +94,7 @@ public FBConfig(Builder builder) { * .eventURL("your event URI") * .startWaitTime(Duration.ZERO) * .offline(false) + * .disableEvents(false) * .build() * */ @@ -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; @@ -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} *