Skip to content

Subscribing non persistent topic error if cluster disallow auto subscription creation #13640

@dragonls

Description

@dragonls

Describe the bug
I am trying to use non persistent topic on pulsar 2.7.2 non persistent topic. Pulsar cluster disallow auto subscription creation, allowAutoSubscriptionCreation=false.

I tried to create subscription using pulsar admin api but receiving error Create subscription on non-persistent topic can only be done through client

To Reproduce
Steps to reproduce the behavior:

  1. Delopy a Pulsar cluster with allowAutoSubscriptionCreation=false
  2. Create a non persistent topic non-persistent://test/test/topic1
  3. Create a consumer to subscribe the topic
  4. See error

Expected behavior
The consumer can subscribe the non persistent topic correctly.

Additional context
The pulsar admin disallow creating subscription on non persistent topic:

if (!topicName.isPersistent()) {
throw new RestException(Response.Status.BAD_REQUEST, "Create subscription on non-persistent topic"
+ "can only be done through client");
}

The broker reject the subscription:

boolean rejectSubscriptionIfDoesNotExist = isDurable
&& !service.isAllowAutoSubscriptionCreation(topicName.toString())
&& !topic.getSubscriptions().containsKey(subscriptionName);
if (rejectSubscriptionIfDoesNotExist) {
return FutureUtil
.failedFuture(
new SubscriptionNotFoundException(
"Subscription does not exist"));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugThe PR fixed a bug or issue reported a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions