5.5.1. Running the Request/Response Examples

5.5.1. Running the Request/Response Examples

The example programs discussed in this section are found in /usr/share/rhm-docs-0.2/cpp/request-response. To run these programs, do the following:

  1. Make sure that a qpidd broker is running:

    $ ps -eaf | grep qpidd
    

    If a broker is running, you should see the qpidd process in the output of the above command. If no broker is running, see the instructions in Chapter 3, Installing MRG Messaging.

  2. In the request-response directory, build the examples using make.

    $ make
    
  3. Run the server.

    $ ./server
    

    You should see the following output:

    $ ./server
    Activating request queue listener for: request
    Waiting for requests
    
  4. In a separate window, start a client:

    $ ./client
    

    You should see the following output:

    Activating response queue listener for: clientac27e517-1788-4d87-9a74-da5cbc34ca51
    Request: Twas brillig, and the slithy toves
    Request: Did gire and gymble in the wabe.
    Request: All mimsy were the borogroves,
    Request: And the mome raths outgrabe.
    Waiting for all responses to arrive ...
    Response: TWAS BRILLIG, AND THE SLITHY TOVES
    Response: DID GIRE AND GYMBLE IN THE WABE.
    Response: ALL MIMSY WERE THE BOROGROVES,
    Response: AND THE MOME RATHS OUTGRABE.
    Shutting down listener for clientac27e517-1788-4d87-9a74-da5cbc34ca51
    

Now we will examine the code for each of these programs. In each section, we will discuss only the code that must be added to the skeleton shown in Section 5.1, “Creating and Closing Sessions”.