2

enter image description here

So here on the aws instance we have tried to connect spring kafka with msk where it works with local kafka. next there is no ssl . I tried telnet its running. But while running the application this exception comes.

Our cluster of msk is in same vpc . all the broker connection configuration strings are fine

  Map<String, Object> configProps = new HashMap<>();
        configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, env.getProperty("spring.kafka.producer.bootstrap-servers"));
        configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
        configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
Tanmay Naik
  • 586
  • 1
  • 4
  • 16
  • Are you running this locally attempting to connect to the MSK? Or running an EC2 instance? – JRK Apr 21 '20 at 10:48
  • @JRK on ec2 instance – Tanmay Naik Apr 21 '20 at 10:49
  • When your Spring Boot application starts, it should log (at INFO level) the ProducerConfig values used by the KafkaProducer. Search for `bootstrap.servers` in the log. What is the actual value? – Chin Huang Apr 21 '20 at 16:45
  • @ChinHuang So as per the log image given producer config are not printed . it stops till admin client configs as it is not able to connect with msk. bootstrap.servers value i have printed on my local are the broker url which is coming perfect – Tanmay Naik Apr 22 '20 at 07:27
  • What is the value of property `spring.kafka.producer.bootstrap-servers`? – Denis Stafichuk Apr 26 '20 at 20:42
  • @DenisStafichuk that is the msk bootstrap server url – Tanmay Naik Apr 27 '20 at 05:44
  • And not localhost:9092 or 127.0.0.1:9092, right? – Denis Stafichuk May 01 '20 at 10:08
  • @DenisStafichuk yes,The value showing in the screenshot is for admin config which is localhost:9092 .The msk bootstrap server url is set for producer & consumer config – Tanmay Naik May 01 '20 at 11:24
  • You may want to check if there are security groups in place that allow the communication between your Spring Kafka machine and the MSK cluster. – Ricardo Ferreira Sep 22 '20 at 19:07

1 Answers1

0

So I came up with the solution where I used Kafka-rest-proxy provided by Confluent which I configured it with AWS MSK and it worked for me

Tanmay Naik
  • 586
  • 1
  • 4
  • 16