Bird
0
0

Given this Java Kafka producer configuration connecting to Amazon MSK: Properties props = new Properties(); props.put("bootstrap.servers", "b-1.mskcluster:9092,b-2.mskcluster:9092"); props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); What will happen if the bootstrap servers are unreachable?

medium📝 Predict Output Q4 of 15
Kafka - Kubernetes and Cloud Deployment
Given this Java Kafka producer configuration connecting to Amazon MSK: Properties props = new Properties(); props.put("bootstrap.servers", "b-1.mskcluster:9092,b-2.mskcluster:9092"); props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); What will happen if the bootstrap servers are unreachable?
AProducer throws an exception immediately on creation
BProducer creation succeeds, but sending messages blocks or fails
CProducer silently drops messages without error
DProducer connects to a default local Kafka broker
Step-by-Step Solution
Solution:
  1. Step 1: Understand Kafka producer bootstrap behavior

    The producer tries to connect to bootstrap servers on sending messages, not on creation.
  2. Step 2: Analyze unreachable bootstrap servers effect

    Producer creation succeeds, but sending messages will block or fail due to no connection.
  3. Final Answer:

    Producer creation succeeds, but sending messages blocks or fails -> Option B
  4. Quick Check:

    Bootstrap unreachable = send blocks/fails [OK]
Quick Trick: Producer connects on send, not on creation [OK]
Common Mistakes:
  • Expecting exception on producer creation
  • Assuming silent message drops
  • Thinking it connects to local broker automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes