|
25 | 25 | import com.google.api.core.ApiFutureCallback; |
26 | 26 | import com.google.api.core.ApiFutures; |
27 | 27 | import com.google.api.gax.batching.BatchingSettings; |
28 | | -import com.google.api.gax.batching.FlowControlSettings; |
29 | | -import com.google.api.gax.batching.FlowController.LimitExceededBehavior; |
30 | 28 | import com.google.api.gax.core.CredentialsProvider; |
31 | 29 | import com.google.api.gax.core.FixedCredentialsProvider; |
32 | 30 | import com.google.api.gax.grpc.ChannelProvider; |
@@ -125,28 +123,6 @@ public Publisher getPublisherWithCustomRetrySettings(TopicName topicName) throws |
125 | 123 | return publisher; |
126 | 124 | } |
127 | 125 |
|
128 | | - public Publisher getPublisherWithCustomFlowControlSettings(TopicName topicName) throws Exception { |
129 | | - // [START pubsub_publisher_flow_settings] |
130 | | - |
131 | | - // Flow control settings restrict the number of outstanding publish requests |
132 | | - int maxOutstandingBatches = 20; |
133 | | - int maxOutstandingRequestBytes = 500000; |
134 | | - |
135 | | - // override behavior on limits exceeded if needed, default behavior is to block |
136 | | - LimitExceededBehavior limitExceededBehavior = LimitExceededBehavior.ThrowException; |
137 | | - |
138 | | - FlowControlSettings flowControlSettings = FlowControlSettings.newBuilder() |
139 | | - .setMaxOutstandingElementCount(maxOutstandingBatches) |
140 | | - .setMaxOutstandingRequestBytes(maxOutstandingRequestBytes) |
141 | | - .setLimitExceededBehavior(limitExceededBehavior) |
142 | | - .build(); |
143 | | - |
144 | | - Publisher publisher = Publisher.defaultBuilder(topicName) |
145 | | - .setFlowControlSettings(flowControlSettings).build(); |
146 | | - // [END pubsub_publisher_flow_settings] |
147 | | - return publisher; |
148 | | - } |
149 | | - |
150 | 126 | public Publisher getSingleThreadedPublisher(TopicName topicName) throws Exception { |
151 | 127 | // [START pubsub_publisher_single_threaded] |
152 | 128 | // create a publisher with a single threaded executor |
|
0 commit comments