Chapter 5. Using MRG Messaging with C++

Chapter 5. Using MRG Messaging with C++

5.1. Creating and Closing Sessions
5.2. Writing Direct Applications in C++
5.2.1. Running the Direct Examples
5.2.2. Declaring and Binding a Queue
5.2.3. Publishing Messages to a Direct Exchange
5.2.4. Reading Messages from the Queue
5.3. Writing Fanout Applications in C++
5.3.1. Running the Fanout Examples
5.3.2. Consuming from a Fanout Exchange
5.3.3. Publishing Messages to the Fanout Exchange
5.4. Writing Publish/Subscribe Applications in C++
5.4.1. Running the Publish-Subscribe Examples
5.4.2. Publishing Messages to a Topic Exchange
5.4.3. Reading Messages from the Queue
5.5. Writing Request/Response Applications in C++
5.5.1. Running the Request/Response Examples
5.5.2. The Client Application
5.5.3. The Server Application
5.6. XML-based Routing in C++
5.6.1. Running the XML-based Routing Examples
5.6.2. Declaring an XML Exchange, Declaring and Binding a Queue
5.6.3. Publishing to an XML Exchange
5.6.4. Reading from the Message Queue
5.7. Durable Queues and Durable Messages in C++
5.8. Using Transactions in C++
5.9. Optimizing message transfer with asynchronous sessions in C++
5.10. Using logging in C++

This chapter shows how to write direct, fanout, publish/subscribe, request/response, and XML-based routing programs in Python. These concepts are explained in Chapter 2, Examples Overview. It then shows how to use important features like persistence and transactions with MRG Messaging. This chapter does not try to teach the entire MRG Messaging C++ API, and it is not encyclopedic in its coverage of AMQP. For more detailed information on the C++ API for MRG Messaging, see the Doxygen documentation installed at /usr/share/doc/qpidc-devel-0.2/html/index.html. For more detailed information on the AMQP model, see the AMQP specification at http://www.amqp.org.

The instructions in this section assume you have installed the client libraries and started a broker using the instructions shown in Chapter 3, Installing MRG Messaging.

Before running the examples, you need to compile the files using the make command.

$ make filename

The binaries created by the make command are standard Linux binaries, and can be run from the command line using ./ before the name of the executable:

$ ./filename

In order to use make, you must have write privileges for the working directory. This generally means that you should copy the /usr/share/rhm-docs-0.2/cpp directory to a place where you can modify the code and create subdirectories as part of the compilation process.

Note

For more information on downloading, installing and starting the broker refer to the MRG Messaging Installation Guide