Bird
0
0

Identify the error in this Python pika code snippet for setting prefetch count:

medium📝 Troubleshoot Q6 of 15
RabbitMQ - Performance Tuning

Identify the error in this Python pika code snippet for setting prefetch count:

channel.basic_qos(prefetch=10)

AIncorrect parameter name; should be prefetch_count instead of prefetch
BMethod name is wrong; should be set_qos instead of basic_qos
CPrefetch count must be a string, not an integer
DNo error; code is correct
Step-by-Step Solution
Solution:
  1. Step 1: Check method and parameters in pika

    The correct method is basic_qos with parameter prefetch_count.
  2. Step 2: Identify parameter mistake

    Using 'prefetch' instead of 'prefetch_count' causes an error.
  3. Final Answer:

    Incorrect parameter name; should be prefetch_count instead of prefetch -> Option A
  4. Quick Check:

    pika basic_qos param = prefetch_count [OK]
Quick Trick: Use prefetch_count param in basic_qos for pika [OK]
Common Mistakes:
MISTAKES
  • Using wrong parameter name
  • Confusing method names
  • Passing wrong data types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More RabbitMQ Quizzes