Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to collate messages by topic, partition due to: Failed to fetch topic metadata for topic #106

Open
gyoho opened this issue Feb 25, 2018 · 3 comments

Comments

@gyoho
Copy link

gyoho commented Feb 25, 2018

Firstly, thanks for developing such a nice tool very useful for Kafka development.

I'm using the withRunningKafka method to test publishing to an embedded Kafka instance using ReactiveKafka.

  "KafkaEvnetSink" should {
    "streams event to kafka" in withRunningKafka {
      val kafkaConfig = EmbeddedKafkaConfig()
      val brokerList = s"localhost:${kafkaConfig.kafkaPort}"
      val topic = "abc"
      val sink = Sink.fromSubscriber(new ReactiveKafka().publish(ProducerProperties(brokerList, topic, new StringEncoder())))

      Source(1 to 10).map(_.toString).to(sink).run()
      consumeFirstStringMessageFrom(topic) shouldBe "1"
    }

The above test throws this error:
15:08:12.857 ERROR k.producer.async.DefaultEventHandler - Failed to collate messages by topic, partition due to: Failed to fetch topic metadata for topic: abc

It seems that this is an issue of port and host according this SO post.

Is this a bug or am I using it wrong?

@manub
Copy link
Owner

manub commented Feb 26, 2018

If you swap localhost with 127.0.0.1 what happens?

@gyoho
Copy link
Author

gyoho commented Feb 26, 2018

Unfortunately, same error.

@manub
Copy link
Owner

manub commented Mar 5, 2018

If you look at the post, the OP managed to fix it by adding the advertised.port property. You can add custom properties to brokers/producers/consumers by using the EmbeddedKafkaConfig class. Give it a go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants