Skip to content
Open
Prev Previous commit
Next Next commit
remove backo, add failsafe
  • Loading branch information
apuig committed Mar 25, 2025
commit af74b24ed91b875d15fa419f5ce56a2743cf50b2
12 changes: 10 additions & 2 deletions analytics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,18 @@
<artifactId>findbugs</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.segment.backo</groupId>
<artifactId>backo</artifactId>
<groupId>dev.failsafe</groupId>
<artifactId>failsafe</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>dev.failsafe</groupId>
<artifactId>failsafe-retrofit</artifactId>
<version>3.3.2</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
40 changes: 11 additions & 29 deletions analytics/src/main/java/com/segment/analytics/Analytics.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ public static class Builder {
private ThreadFactory threadFactory;
private int flushQueueSize;
private int maximumFlushAttempts;
private int maximumQueueSizeInBytes;
private long flushIntervalInMillis;
private int queueCapacity;
private boolean forceTlsV1 = false;
Expand Down Expand Up @@ -267,17 +266,6 @@ public Builder flushQueueSize(int flushQueueSize) {
return this;
}

/** Set the queueSize at which flushes should be triggered. */
@Beta
public Builder maximumQueueSizeInBytes(int bytes) {
if (bytes < 1) {
throw new IllegalArgumentException("maximumQueueSizeInBytes must not be less than 1.");
}

this.maximumQueueSizeInBytes = bytes;
return this;
}

/** Set the interval at which the queue should be flushed. */
@Beta
public Builder flushInterval(long flushInterval, TimeUnit unit) {
Expand Down Expand Up @@ -369,9 +357,6 @@ public Analytics build() {
if (flushQueueSize == 0) {
flushQueueSize = Platform.get().defaultFlushQueueSize();
}
if (maximumQueueSizeInBytes == 0) {
maximumQueueSizeInBytes = MESSAGE_QUEUE_MAX_BYTE_SIZE;
}
if (maximumFlushAttempts == 0) {
maximumFlushAttempts = 3;
}
Expand Down Expand Up @@ -430,20 +415,17 @@ public void log(String message) {

SegmentService segmentService = restAdapter.create(SegmentService.class);

AnalyticsClient analyticsClient =
AnalyticsClient.create(
endpoint,
segmentService,
queueCapacity,
flushQueueSize,
flushIntervalInMillis,
maximumFlushAttempts,
maximumQueueSizeInBytes,
log,
threadFactory,
networkExecutor,
writeKey,
gson);
AnalyticsClient analyticsClient = AnalyticsClient.create(
endpoint,
segmentService,
queueCapacity,
flushQueueSize,
flushIntervalInMillis,
log,
threadFactory,
networkExecutor,
writeKey,
gson);

return new Analytics(analyticsClient, messageTransformers, messageInterceptors, log);
}
Expand Down
Loading