1313
1414package io .nats .client .impl ;
1515
16- import io .nats .client .*;
16+ import io .nats .client .JetStream ;
17+ import io .nats .client .JetStreamSubscription ;
18+ import io .nats .client .Message ;
19+ import io .nats .client .PushSubscribeOptions ;
1720import io .nats .client .api .ConsumerConfiguration ;
1821import io .nats .client .api .ConsumerInfo ;
1922import org .junit .jupiter .api .Test ;
@@ -294,8 +297,9 @@ public void testHeartbeat() throws Exception {
294297 });
295298 }
296299
297- @ Test
298- public void testFlowControl () throws Exception {
300+ @ ParameterizedTest
301+ @ ValueSource (strings = {"500,1024" , "1,500000" })
302+ public void testFlowControl (String pendingLimits ) throws Exception {
299303 runInJsServer (nc -> {
300304 // Create our JetStream context to receive JetStream messages.
301305 JetStream js = nc .jetStream ();
@@ -312,7 +316,8 @@ public void testFlowControl() throws Exception {
312316 // This is configured so the subscriber ends up being considered slow
313317 JetStreamSubscription sub = js .subscribe (SUBJECT , pso );
314318 nc .flush (Duration .ofSeconds (5 ));
315- sub .setPendingLimits (Consumer .DEFAULT_MAX_MESSAGES , 1024 );
319+ String [] split = pendingLimits .split ("," );
320+ sub .setPendingLimits (Integer .parseInt (split [0 ]), Integer .parseInt (split [1 ]));
316321
317322 // publish more message data than the subscriber will handle
318323 byte [] data = new byte [1024 ];
0 commit comments