Bird
0
0

You wrote this code to batch publish messages but no messages appear in the queue:

medium📝 Troubleshoot Q14 of 15
RabbitMQ - Performance Tuning
You wrote this code to batch publish messages but no messages appear in the queue:
channel.txSelect()
channel.basic_publish(exchange='', routing_key='queue', body='Hello')
channel.basic_publish(exchange='', routing_key='queue', body='World')
What is the likely problem?
AYou forgot to call channel.txCommit() to send the batch.
BYou must call channel.txRollback() after publishing.
CYou should use channel.basic_consume() instead of basic_publish().
DThe routing_key 'queue' is invalid and blocks messages.
Step-by-Step Solution
Solution:
  1. Step 1: Check transaction usage

    txSelect() starts transaction but no txCommit() means messages are not sent yet.
  2. Step 2: Identify missing commit

    Without txCommit(), messages stay uncommitted and invisible to consumers.
  3. Final Answer:

    You forgot to call channel.txCommit() to send the batch. -> Option A
  4. Quick Check:

    Missing txCommit() = no messages sent [OK]
Quick Trick: Always call txCommit() after batch publish [OK]
Common Mistakes:
MISTAKES
  • Calling txRollback() instead of txCommit()
  • Confusing consume with publish
  • Assuming routing_key 'queue' is invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More RabbitMQ Quizzes