question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Subscribing to unknown topic

See original GitHub issue

In case the topic doesn’t exist and a consumer subscribes to it, there’s no easy way to find out that the topic is not there except making a call to fetch the metadata before attempting to subscribe.

Furthermore, consuming from such a consumer returns ERR_TIMEOUT as if the topic existed, but there were no activity in there.

But the biggest problem is that when the topic gets created and message start flowing there, the consumer that’s subscribed before topic creation will never receive these messages nor would it indicate any issue.

I’m not quite sure how to deal with this. Creating the topic by default with default parameters seem dangerous since it can easily go unnoticed, throwing an error on attempt to subscribe/consume might be a nice feature, kafkacat does that for example. Tracking whether the topic existence have changed and re-subscribing to start receiving messages once the topic was created could also be an option. Not sure which option is better, but silently ignoring the error is definitely worse then any of them.

Would be nice know your opinion on this before deciding how to deal with topic creation in our environment.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
webmakerstevecommented, Mar 10, 2017

librdkafka does have an error code for when the topic does not exist, but I believe this is only done on the producer side rather than the consumer side when using subscriptions. Previously when using the low level consumer, I believe it took a topic object rather than a topic string, and perhaps some more sophisticated validation was done while consuming, but now it is silent about the error.

What I would recommend doing is reading the metadata fetched by default at connect time (it is passed into the callback for connect, or the on('ready'). event. It will give a list of topics that are available.

Then, in your code, you can check that a subscription is subscribing to a topic that you have metadata for, and throw otherwise.

Perhaps this functionality could be encapsulated into the library for a better experience. But I’m undecided. It definitely is annoying that it would fail silently for you.

I’m pretty sure Kafkacat does something similar under the hood. It fetches metadata for the topic you specify with -t and the metadata request comes back with topic does not exist. Would love to hear thoughts on the direction people are most fond of.

0reactions
webmakerstevecommented, Mar 16, 2017

I’m happy with it behaving the way @edenhill describes, so I’m going to close the issue 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to subscribe to uknown amount of topics with unknown ...
I am trying to make a lognode which reads the available topics and types, use this information in a GUI to select the...
Read more >
What happens if I subscribe to a MQTT topic which has never ...
Think of it this way: If a client could not subscribe to a topic that has never been published to, then the first...
Read more >
Trying to subscribe to a push topic gives unknown client
The troubleshooting approach I would suggest: As Workbench is an open-source free tool and is not officially supported by Salesforce. Streaming ...
Read more >
Subscribe to unknown topic | Northwest Seaport - Port of Tacoma
Our robust network of logistics service providers will help you find the optimal solution for efficient and safe movement of your containerized and...
Read more >
The Unknown - Topic - YouTube
Skip navigation. Search. Search. Sign in. The Unknown - Topic. The Unknown - Topic. 130 subscribers. Subscribe. Home. Playlists.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found