But you get an error: 'NoneType' object has no attribute 'value'. What is the likely cause?
medium
A. The print statement syntax is incorrect.
B. The topic 'payments' does not exist.
C. No messages were available to consume during poll timeout.
D. The consumer client was not connected to Confluent Cloud.
Solution
Step 1: Understand poll method behavior
poll returns None if no messages are received within the timeout period.
Step 2: Analyze error cause
Calling value() on None causes the error; this means no messages arrived during poll.
Final Answer:
No messages were available to consume during poll timeout. -> Option C
Quick Check:
poll returns None if no messages [OK]
Hint: poll returns None if no messages, check before accessing [OK]
Common Mistakes:
Assuming topic absence causes this error
Blaming connection issues without checking poll
Thinking print syntax is wrong
5. You want to create a Confluent Cloud Kafka topic that automatically deletes messages after 7 days. Which configuration should you apply when creating the topic?
hard
A. Set the topic's retention.ms to 604800000 (7 days in milliseconds).
B. Set the topic's cleanup.policy to 'compact'.
C. Set the topic's max.message.bytes to 7.
D. Set the topic's partitions to 7.
Solution
Step 1: Understand retention.ms setting
retention.ms controls how long messages are kept before deletion, in milliseconds.
Step 2: Calculate 7 days in milliseconds
7 days x 24 hours x 60 minutes x 60 seconds x 1000 = 604800000 ms.
Step 3: Match configuration to requirement
Setting retention.ms to 604800000 ensures messages delete after 7 days; other options do not control retention time.
Final Answer:
Set the topic's retention.ms to 604800000 (7 days in milliseconds). -> Option A
Quick Check:
retention.ms = 7 days in ms [OK]
Hint: Use retention.ms for message lifetime in ms [OK]
Common Mistakes:
Confusing cleanup.policy with retention time
Setting max.message.bytes instead of retention
Changing partitions unrelated to retention
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.