From 45a47a3334ab4462e7fb7f906e1d695381e67d55 Mon Sep 17 00:00:00 2001 From: sidd0610 Date: Fri, 2 Aug 2024 08:54:07 -0700 Subject: [PATCH] Update batch size usage in Subscribe examples (#61) * Update batch size usage in Subscribe examples --- java/src/main/java/genericpubsub/ManagedSubscribe.java | 4 ++-- java/src/main/java/genericpubsub/Subscribe.java | 4 ++-- java/src/main/resources/arguments.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/java/src/main/java/genericpubsub/ManagedSubscribe.java b/java/src/main/java/genericpubsub/ManagedSubscribe.java index 8463b4c..344382f 100644 --- a/java/src/main/java/genericpubsub/ManagedSubscribe.java +++ b/java/src/main/java/genericpubsub/ManagedSubscribe.java @@ -30,7 +30,7 @@ * @author jalaya */ public class ManagedSubscribe extends CommonContext implements StreamObserver { - private static int BATCH_SIZE = 5; + private static int BATCH_SIZE; private StreamObserver serverStream; private Map schemaCache = new ConcurrentHashMap<>(); private final CountDownLatch serverOnCompletedLatch = new CountDownLatch(1); @@ -45,7 +45,7 @@ public ManagedSubscribe(ExampleConfigurations exampleConfigurations) { isActive.set(true); this.managedSubscriptionId = exampleConfigurations.getManagedSubscriptionId(); this.developerName = exampleConfigurations.getDeveloperName(); - BATCH_SIZE = Math.min(5, exampleConfigurations.getNumberOfEventsToSubscribeInEachFetchRequest()); + this.BATCH_SIZE = exampleConfigurations.getNumberOfEventsToSubscribeInEachFetchRequest(); this.processChangedFields = exampleConfigurations.getProcessChangedFields(); } diff --git a/java/src/main/java/genericpubsub/Subscribe.java b/java/src/main/java/genericpubsub/Subscribe.java index 90eb91f..767e2ca 100644 --- a/java/src/main/java/genericpubsub/Subscribe.java +++ b/java/src/main/java/genericpubsub/Subscribe.java @@ -55,7 +55,7 @@ public Subscribe(ExampleConfigurations exampleConfigurations) { super(exampleConfigurations); isActive.set(true); this.exampleConfigurations = exampleConfigurations; - this.BATCH_SIZE = Math.min(5, exampleConfigurations.getNumberOfEventsToSubscribeInEachFetchRequest()); + this.BATCH_SIZE = exampleConfigurations.getNumberOfEventsToSubscribeInEachFetchRequest(); this.responseStreamObserver = getDefaultResponseStreamObserver(); this.setupTopicDetails(exampleConfigurations.getTopic(), false, false); this.replayPreset = exampleConfigurations.getReplayPreset(); @@ -68,7 +68,7 @@ public Subscribe(ExampleConfigurations exampleConfigurations, StreamObserver