Skip to content

Commit ac90b10

Browse files
committed
Hide credit settings
Revert the public API part of f78ac08. Providing 1 initial credit on subscription and another 1 on each incoming chunk seems appropriate for most use cases. We'll provide more options if necessary. References #262
1 parent aaf196e commit ac90b10

File tree

5 files changed

+4
-20
lines changed

5 files changed

+4
-20
lines changed

src/main/java/com/rabbitmq/stream/ConsumerBuilder.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,6 @@ public interface ConsumerBuilder {
151151
*/
152152
ConsumerBuilder noTrackingStrategy();
153153

154-
/**
155-
* Define credit values for the subscription.
156-
*
157-
* <p>This is an experimental API, subject to change.
158-
*
159-
* @param initial the initial number of credits, default is 10
160-
* @param onChunkDelivery the number of credits provided on each chunk delivery, default is 1
161-
* @return this builder instance
162-
* @since 0.10.0
163-
*/
164-
ConsumerBuilder credits(int initial, int onChunkDelivery);
165-
166154
/**
167155
* Create the configured {@link Consumer}
168156
*

src/main/java/com/rabbitmq/stream/impl/ConsumersCoordinator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,6 @@ synchronized void add(
943943
subscriptionContext.offsetSpecification());
944944

945945
checkNotClosed();
946-
// FIXME consider using fewer initial credits
947946
byte subId = subscriptionId;
948947
Client.Response subscribeResponse =
949948
Utils.callAndMaybeRetry(

src/main/java/com/rabbitmq/stream/impl/StreamConsumerBuilder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ public ConsumerBuilder noTrackingStrategy() {
132132
return this;
133133
}
134134

135-
@Override
136135
public ConsumerBuilder credits(int initial, int onChunkDelivery) {
137136
if (initial <= 0 || onChunkDelivery <= 0) {
138137
throw new IllegalArgumentException("Credits must be positive");

src/main/java/com/rabbitmq/stream/perf/StreamPerfTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ public class StreamPerfTest implements Callable<Integer> {
418418
@CommandLine.Option(
419419
names = {"--credits", "-cr"},
420420
description = "initial and additional credits for subscriptions",
421-
defaultValue = "10:1",
421+
defaultValue = "1:1",
422422
converter = Utils.CreditsTypeConverter.class)
423423
private CreditSettings credits;
424424

@@ -994,10 +994,7 @@ public Integer call() throws Exception {
994994
AtomicLong messageCount = new AtomicLong(0);
995995
String stream = stream(streams, i);
996996
ConsumerBuilder consumerBuilder =
997-
environment
998-
.consumerBuilder()
999-
.offset(this.offset)
1000-
.credits(this.credits.initial(), this.credits.additional());
997+
environment.consumerBuilder().offset(this.offset);
1001998

1002999
if (this.superStreams) {
10031000
consumerBuilder.superStream(stream);

src/test/java/com/rabbitmq/stream/impl/ClientFlowControlTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
import com.rabbitmq.stream.OffsetSpecification;
2222
import com.rabbitmq.stream.impl.Client.ClientParameters;
2323
import java.util.concurrent.CountDownLatch;
24-
import java.util.concurrent.atomic.AtomicInteger;import java.util.concurrent.atomic.AtomicReference;
24+
import java.util.concurrent.atomic.AtomicInteger;
25+
import java.util.concurrent.atomic.AtomicReference;
2526
import org.junit.jupiter.api.Test;
2627
import org.junit.jupiter.api.TestInfo;
2728
import org.junit.jupiter.api.extension.ExtendWith;

0 commit comments

Comments
 (0)