Performance: RabbitTemplate for producing
MEDIUM IMPACT
This affects message sending speed and resource usage in the application, impacting how fast messages reach the broker and how much CPU and memory are used.
rabbitTemplate.convertAndSend(exchange, routingKey, message); // used with async executor or batching to avoid blocking
rabbitTemplate.convertAndSend(exchange, routingKey, message); // called synchronously for each message without batching or async handling
| Pattern | Thread Blocking | Network Calls | CPU Usage | Verdict |
|---|---|---|---|---|
| Synchronous convertAndSend per message | High (blocks thread) | One per message | High under load | [X] Bad |
| Asynchronous or batched sending | Low (non-blocking) | Fewer or parallelized | Lower CPU usage | [OK] Good |