RabbitTemplate receive methods pull messages from a RabbitMQ queue. They return raw Message objects or convert messages into application objects before returning them. section 9.2.3
Choose the method according to the message form and waiting behavior:
- Use receive() for raw messages, or receiveAndConvert() for objects produced by the configured message converter. section 9.2.3
- Pass a queue name when consuming from a specific queue; consumers do not need to provide an exchange or routing key. section 9.2.3
- Pass a timeout to wait for a message; the default is zero milliseconds, so an empty queue can produce null immediately. section 9.2.3
Pulling an order
A receiver can pull an order from tacocloud.order.queue and convert it directly: return (TacoOrder) rabbit.receiveAndConvert("tacocloud.order.queue"); A 30-second wait can be supplied when immediate polling is not enough.
