Skip to content

Unable to auto-create-topic with Consumer. #374

@daadu

Description

@daadu

Describe the bug
I am unable to auto create topic with consumer, after specifying $consumer->withOption('allow.auto.create.topics', true)->build(); (also check with string "true" value)

To Reproduce
Steps to reproduce the behavior:

  1. Create consumer with allow.auto.create.topics: true config that listens to a topic that doesn't exists yet.
  2. Ensure that the broker config is correct -- allows auto creation of topic for the user (for testing use the super user to be absolutely sure).
  3. Call $consumer->consume()
  4. Notice error, something like:
{"message":"[CONSUMER] Error to consume message","context":{"message":{"err":3,"topic_name":"mytopic","timestamp":-1,"partition":0,"payload":"Subscribed topic not available: mytopic: Broker: Unknown to ...
{"message":"Broker: Unknown topic or partition","context":{"exception":{"class":"Junges\\Kafka\\Exceptions\\KafkaConsumerException","message":"Broker: Unknown topic or partition","code":3,"file":"/laravel/vendor/mateusjunges/larave ...

In Consumer.php line 410:                                                                                                                                                                                                               

Broker: Unknown topic or partition  

Expected behavior
Topic should be created with this config, when set with consumer and at the broker level it is allowed.

Additional context

"php": "^8.3",
"ext-rdkafka": "*",
"mateusjunges/laravel-kafka": "^1.13",

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions