Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Sending and Receiving Messages

...

  • Direct - will forward messages to bound queues if the routing key matches the queue name. The routing key pattern on the binding is not required.
  • Fanout - will forward all messages to bound queues. The routing key pattern on the binding is not required.
  • Topic - used for pub/sub - will forward to queues where the message's routing key matches the routing key pattern on the binding between the Queue and the Topic Exchange.
  • HeaderA headers exchange routes messages based on arguments containing headers and optional values. Headers exchanges are very similar to topic exchanges, but route messages based on header values instead of routing keys. 

Exchanges can be bound to Queues or other Exchanges.
Exchanges and Queues are linked via Bindings - sometimes the Binding uses a Routing Key Pattern. The Message's Routing Key can be a single word. More generally, it can be several words delimited by dots. The Routing Key pattern supports * for any 1 word and also # for any number of words.

When you configure an exchange - you can specify an Alternative Exchange where messages sent to this exchange but not routed by this exchange (to another Exchange or Queue) are sent. This is different but related to Dead Letter Exchanges where messages that are rejected by Q consumers (or timed out on Q, or rejected because of full Q ) are sent

Direct Messaging

To send a message to a specific Queue - you send the message to the 'default exchange' using the Queue Name as the 'routing key'. There is no routing key pattern required on the binding between the Direct Exchange and the Queues it's bound too.

...

Rabbit Payloads are an array of bytes. So even for String based messaging - without a converter, you have to convert a String to/from bytes.
It was straightforward to send messages to Queues using org.springframework.amqp.rabbit.core.RabbitTemplate
It was straightforward to recv messages from Queues using the annotation : org.springframework.amqp.rabbit.annotation.RabbitListener

...