createSimpleBatcherBuidler(receiver) .setThresholds(BatchingThresholds.<SimpleBatch>create(4)) .setFlowController( getTrackedIntegerBatchingFlowController( 3L, null, LimitExceededBehavior.ThrowException))
createSimpleBatcherBuidler(receiver) .setThresholds(BatchingThresholds.<SimpleBatch>create(2)) .setFlowController( getTrackedIntegerBatchingFlowController(2L, null, LimitExceededBehavior.Block)) .build();
createSimpleBatcherBuidler(receiver) .setThresholds(BatchingThresholds.<SimpleBatch>create(4)) .setFlowController( getTrackedIntegerBatchingFlowController( 3L, null, LimitExceededBehavior.ThrowException))
private ThresholdBatcher<Batch<RequestT, ResponseT>> createBatcher(PartitionKey partitionKey) { BatchExecutor<RequestT, ResponseT> processor = new BatchExecutor<>(batchingDescriptor, partitionKey); BatchingFlowController<Batch<RequestT, ResponseT>> batchingFlowController = new BatchingFlowController<>( flowController, new BatchElementCounter<>(batchingDescriptor), new BatchByteCounter<RequestT, ResponseT>()); return ThresholdBatcher.<Batch<RequestT, ResponseT>>newBuilder() .setThresholds(getThresholds(batchingSettings)) .setExecutor(executor) .setMaxDelay(batchingSettings.getDelayThreshold()) .setReceiver(processor) .setFlowController(batchingFlowController) .setBatchMerger(new BatchMergerImpl<RequestT, ResponseT>()) .build(); }
private ThresholdBatcher<Batch<RequestT, ResponseT>> createBatcher(PartitionKey partitionKey) { BatchExecutor<RequestT, ResponseT> processor = new BatchExecutor<>(batchingDescriptor, partitionKey); BatchingFlowController<Batch<RequestT, ResponseT>> batchingFlowController = new BatchingFlowController<>( flowController, new BatchElementCounter<>(batchingDescriptor), new BatchByteCounter<RequestT, ResponseT>()); return ThresholdBatcher.<Batch<RequestT, ResponseT>>newBuilder() .setThresholds(getThresholds(batchingSettings)) .setExecutor(executor) .setMaxDelay(batchingSettings.getDelayThreshold()) .setReceiver(processor) .setFlowController(batchingFlowController) .setBatchMerger(new BatchMergerImpl<RequestT, ResponseT>()) .build(); }
private static ThresholdBatcher.Builder<SimpleBatch> createSimpleBatcherBuidler( AccumulatingBatchReceiver<SimpleBatch> receiver) { return ThresholdBatcher.<SimpleBatch>newBuilder() .setThresholds(BatchingThresholds.<SimpleBatch>create(100)) .setExecutor(EXECUTOR) .setMaxDelay(Duration.ofMillis(10000)) .setReceiver(receiver) .setFlowController(ThresholdBatcherTest.<SimpleBatch>getDisabledBatchingFlowController()) .setBatchMerger(new SimpleBatchMerger()); }