O'Reilly logo

RabbitMQ Cookbook by Sigismondo Boschi, Gabriele Santomaggio

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Embedding message destinations within messages

In this example, we show how to use a single publish to send a message with multiple routing keys. The standard AMQP doesn't provide this feature but luckily, RabbitMQ does so using a message properties header. This extension is called sender-selected distribution.

The behavior of the extension is similar to e-mail logics. It uses Carbon Copy (CC) and Blind Carbon Copy (BCC). This is the reason you will find CC and BCC consumers in the source code, located in Chapter02/Recipe09/Java/src/rmqexample:

  • Producer.java
  • Consumer.java
  • StatsConsumer.java
  • CCStatsConsumer.java
  • BCCStatsConsumer.java

Getting ready

To use this recipe, we need to set up the Java development environment as indicated in the Introduction

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required