private FlowControlSettings getFlowControlSettings ( ) { return FlowControlSettings . newBuilder ( ) . setLimitExceededBehavior ( FlowController . LimitExceededBehavior . Block ) . setMaxOutstandingElementCount ( ( long ) conf . basic . maxBatchSize * conf . maxThreads / conf . advanced . numSubscribers ) . build ( ) ; }
Returns a flow control setting such that a subscriber will block if it has buffered more messages than can be processed in a single batch times the number of record processors . Since the flow control settings are per subscriber we should divide by the number of subscribers to avoid buffering too much data in each subscriber .