Bird
0
0

Which of the following is the correct way to publish a batch of messages using the RabbitMQ Java client?

easy📝 Syntax Q3 of 15
RabbitMQ - Performance Tuning
Which of the following is the correct way to publish a batch of messages using the RabbitMQ Java client?
Achannel.basicPublishBatch(exchange, routingKey, props, messageBody);
Bchannel.basicPublish(exchange, routingKey, props, messageBody); repeated in a loop without transaction
Cchannel.txSelect(); publish messages; channel.txCommit();
Dchannel.batchPublish(exchange, routingKey, props, messageBody);
Step-by-Step Solution
Solution:
  1. Step 1: Recall RabbitMQ Java client batch methods

    There is no basicPublishBatch or batchPublish method in the Java client.
  2. Step 2: Use transactions for batch publishing

    Using txSelect and txCommit wraps multiple publishes in a transaction, batching them.
  3. Final Answer:

    channel.txSelect(); publish messages; channel.txCommit(); -> Option C
  4. Quick Check:

    Java batch publish = Transaction methods [OK]
Quick Trick: Use txSelect and txCommit to batch in Java client [OK]
Common Mistakes:
MISTAKES
  • Assuming basicPublishBatch exists
  • Using non-existent batchPublish method
  • Publishing without transaction for batch

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More RabbitMQ Quizzes