pulsar: Topic creation not working properly
Search before asking
- I searched in the issues and found nothing similar.
Read release policy
- I understand that unsupported versions don’t get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
Version
3.2.2
Minimal reproduce step
Below are the steps to reproduce:
- Run the below commands to create tenant then namespace and then topic:
bin/pulsar-admin tenants create my-tenant
> bin/pulsar-admin namespaces create my-tenant/new-name
> bin/pulsar-admin topics create persistent://my-tenant/new-name/topic-pers
> bin/pulsar-admin topics create non-persistent://my-tenant/new-name/topic-non
> bin/pulsar-admin topics create persistent://my-tenant/new-name/topic-pers-1
> bin/pulsar-admin topics create non-persistent://my-tenant/new-name/topic-non-1
>
- Run the below command to list the topics present in namespace
bin/pulsar-admin topics list my-tenant/new-name
What did you expect to see?
All the topics which we have created should be present in the namespace
What did you see instead?
Sometimes after running the command to list the topics only one topic is showing or sometime two topics and sometimes 0 topics
And while running the pulsar client to send the messages from the producer and consume in consumer side below logs from pulsar client SDK
> 2024-04-18T08:18:55,054 DEBUG [pulsar-client-io-1-3] org.apache.pulsar.common.protocol.PulsarDecoder - [localhost/127.0.0.1:6650] Received cmd GET_TOPICS_OF_NAMESPACE_RESPONSE
> 2024-04-18T08:18:55,054 DEBUG [pulsar-client-io-1-3] org.apache.pulsar.client.impl.ClientCnx - [id: 0x7c29b63d, L:/127.0.0.1:50936 - R:localhost/127.0.0.1:6650] Received get topics of namespace success response from server: 3411313542779248996 - topics.size: 0
> 2024-04-18T08:18:55,055 DEBUG [pulsar-client-io-1-3] org.apache.pulsar.client.impl.BinaryProtoLookupService - [namespace: my-tenant/new-name] Success get topics list in request: 3411313542779248996
> 2024-04-18T08:18:55,055 DEBUG [pulsar-client-io-1-3] org.apache.pulsar.client.impl.PulsarClientImpl - Get topics under namespace my-tenant/new-name, topics.size: 0, topicsHash: 00000000, changed: true, filtered: true
> 2024-04-18T08:18:55,808 DEBUG [pulsar-client-io-1-3] org.apache.pulsar.client.impl.PatternMultiTopicsConsumerImpl - Not creating topic list watcher for subscription mode ALL
NOTE: we were trying to use the multi-topic subscription and using the ALLTopics and sending the messages to all persistent and non-persistent topics
Anything else?
No response
Are you willing to submit a PR?
- I’m willing to submit a PR!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21 (14 by maintainers)
The auto-topic creation question was resolved.
There is another issue for the regex consumer + non-persistent topics question: https://github.com/apache/pulsar/issues/22529
Closing.
I just tried to send a message to a non-existent topic and it worked as expected. I see the topics that were automatically created on producer creation in the namespace topics list.
Can you confirm that the auto topic creation policy is enabled for your namespace?
It is enabled by default on the broker level and should be inherited by namespace.
(I already explicitly set it on the namespace level)
If it’s not enabled, you can try to set it on the namespace level.
@ragaur-tibco by default Pulsar deletes inactive topics after some timeout. Probably it’s the reason.
https://pulsar.apache.org/docs/next/admin-api-topics/#create-1
You can try to override this setting on the namespace level, re-create the topics, and check if the issue still exists.
pulsar-admin namespaces set-inactive-topic-policies -d -m delete_when_no_subscriptions -t 1m my-tenant/new-name