Kafka - with Java/Python
You need to consume messages from two Kafka topics, orders and payments, using a single Java consumer instance. Which code snippet correctly subscribes to both topics?
You need to consume messages from two Kafka topics, orders and payments, using a single Java consumer instance. Which code snippet correctly subscribes to both topics?
subscribe() method accepts a collection of topic names to subscribe to multiple topics.Arrays.asList to pass both topics as a list.assign() with partitions, which is manual assignment, not subscription.subscribe() twice, which overwrites the first subscription.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions