55
55
import org .apache .pulsar .broker .service .Replicator ;
56
56
import org .apache .pulsar .broker .service .StreamingStats ;
57
57
import org .apache .pulsar .broker .service .Subscription ;
58
+ import org .apache .pulsar .broker .service .SubscriptionOption ;
58
59
import org .apache .pulsar .broker .service .Topic ;
59
60
import org .apache .pulsar .broker .service .TransportCnx ;
60
61
import org .apache .pulsar .broker .stats .ClusterReplicationMetrics ;
@@ -224,6 +225,16 @@ public CompletableFuture<Void> checkIfTransactionBufferRecoverCompletely(boolean
224
225
return CompletableFuture .completedFuture (null );
225
226
}
226
227
228
+ @ Override
229
+ public CompletableFuture <Consumer > subscribe (SubscriptionOption option ) {
230
+ return internalSubscribe (option .getCnx (), option .getSubscriptionName (), option .getConsumerId (),
231
+ option .getSubType (), option .getPriorityLevel (), option .getConsumerName (),
232
+ option .isDurable (), option .getStartMessageId (), option .getMetadata (),
233
+ option .isReadCompacted (), option .getInitialPosition (),
234
+ option .getStartMessageRollbackDurationSec (), option .isReplicatedSubscriptionStateArg (),
235
+ option .getKeySharedMeta ());
236
+ }
237
+
227
238
@ Override
228
239
public CompletableFuture <Consumer > subscribe (final TransportCnx cnx , String subscriptionName , long consumerId ,
229
240
SubType subType , int priorityLevel , String consumerName ,
@@ -232,6 +243,19 @@ public CompletableFuture<Consumer> subscribe(final TransportCnx cnx, String subs
232
243
InitialPosition initialPosition ,
233
244
long resetStartMessageBackInSec , boolean replicateSubscriptionState ,
234
245
KeySharedMeta keySharedMeta ) {
246
+ return internalSubscribe (cnx , subscriptionName , consumerId , subType , priorityLevel , consumerName ,
247
+ isDurable , startMessageId , metadata , readCompacted , initialPosition , resetStartMessageBackInSec ,
248
+ replicateSubscriptionState , keySharedMeta );
249
+ }
250
+
251
+ private CompletableFuture <Consumer > internalSubscribe (final TransportCnx cnx , String subscriptionName ,
252
+ long consumerId , SubType subType , int priorityLevel ,
253
+ String consumerName , boolean isDurable ,
254
+ MessageId startMessageId , Map <String , String > metadata ,
255
+ boolean readCompacted , InitialPosition initialPosition ,
256
+ long resetStartMessageBackInSec ,
257
+ boolean replicateSubscriptionState ,
258
+ KeySharedMeta keySharedMeta ) {
235
259
236
260
return brokerService .checkTopicNsOwnership (getName ()).thenCompose (__ -> {
237
261
final CompletableFuture <Consumer > future = new CompletableFuture <>();
0 commit comments