Publish/Subscribe DDS Newsgroup Topic Monitoring Service (Assignment 2)

Overview

In this assignment, you will implement a simple DDS newsgroup topic monitoring application using the Data Distribution Service (DDS). A publisher application will (1) create new topics associated with newsgroups, (2) publish data on those newsgroup topics, and (3) delete topics. A middle-tier subscriber application will use the DDS built-in topic mechanism to receive notification of the creation/deletion of newsgroup topics, as well as postings associated with the newsgroup topics. You will need to write all the code for this assignment.

DDS IDL Specification

The DDS Topic Monitoring Service application will be designed as a publisher/subscriber pair using the following IDL specification that is placed in a file called Posting.idl:

// The #pragma is specific to OpenDDS
#pragma DCPS_DATA_TYPE "Posting"

struct Posting {
    string subject;
    string body;
    string author;
};
You will use the mwc.pl Perl script on an MPC file (e.g., Posting.mpc) that will the Posting.idl file to generate the needed support code and makefiles for the publisher and subscriber executables. This script is located in $ACE_ROOT/bin. For Linux, the command line might look something like this:
 $ $ACE_ROOT/bin/mwc.pl
-type gnuace 
For Visual Studio 2005, the command line might look something like this:
 C:\> %ACE_ROOT%\bin\mwc.pl
-type vc8 
The makefiles or solution files should then be ready for you to use.

The publisher application executable (whose source code you must write) will create/delete newgroups topics and send out postings based on the Posting IDL shown above. The subscriber application (whose source code you also must write) will then output the newsgroup topics and postings when they are received.

Subscriber Functionality

First, make sure that the mpc.pl script has been run on the Posting.mpc file to generate the needed support code and makefiles.

When the subscriber starts up, it will use the DDS built-in topic feature to wait for the creation/deletion of newsgroup topics and receive the postings when when arrive (e.g., display them to the screen). In particular, you will need to create a subscriber application that will

Additionally, you will need to implement the appropriate DataReaderListener to: The subscriber executable takes 2 command line arguments: one to set up the transport (i.e., -ORBSvcConf tcp.conf) and one to set up the subscriber (i.e., -DCPSConfigFile sub.ini). You will not need to modify these files. Here are the tcp.conf and sub.ini files.

If anything fails to work properly the subscriber main function should simply print out the appropriate exception and exit with a return status of 1. If everything works correctly, the program should exit with a return status of 0.

Publisher Functionality

As noted above, make sure that the mpc.pl script has been run on the Posting.mpc and Posting.idl files to generate the needed support code and makefiles.

When the publisher starts up, it will create newsgroup topics, send postings (e.g., 10 postings per newsgroup), and then delete the topic. In particular, you will need to write a publisher application that

Additionally, you will need to implement a class that does the following: The publisher executable takes 2 command line arguments: one to set up the transport (i.e., -ORBSvcConf tcp.conf) and one to set up the publisher (i.e., -DCPSConfigFile pub.ini). You will not need to modify these files. Here are the tcp.conf and pub.ini files.

If anything fails to work properly the publisher should simply print out the appropriate exception and exit with a return status of 1. If everything works correctly, the program should exit with a return status of 0.


Running OpenDDS Applications

For this assignment, it is assumed that all applicable executables (i.e., the publisher, the subscriber, and the information repository) are run from the same NFS-enabled directory. There is a common file that is shared between the executables and launching from the same directory simplifies the sharing of this file.

Also, the order in which the executables are invoked in important. The Info Repository needs to be launched first, then the subscriber, then the publisher.

OpenDDS' Info Repository

The OpenDDS implementation uses an information repository to keep track of various information related to DDS participants. The Info Repository is a separate executable that must be started before all the other executables are launched. Here is the domain_ids file to use.

The Info Repository should be launched as follows:


$DDS_ROOT/dds/InfoRepo/DCPSInfoRepo -ORBSvcConf tcp.conf -o repo.ior -d domain_ids
where DDS_ROOT is equivalent to $ACE_wrappers/TAO/DDS.

It also needs to be manually killed when the DDS application is done running. There will be a file named repo.ior left in the directory. It is a good idea to delete this file to avoid any confusion for succeeding invocations (although there may be no harm in leaving it alone).

Example Output

The following output is an example of what your output might look like.

Example output for the Info Repository:


$ $DDS_ROOT/dds/InfoRepo/DCPSInfoRepo -ORBSvcConf tcp.conf -o repo.ior -d domain_ids
(12588|3078248128)  13:55:01.262144 Repo main
(12588|3078248128)INFO: not using file configuration - no configuration file specified.

Example output for the supplier:


$ ./subscriber -ORBSvcConf tcp.conf -DCPSConfigFile sub.ini
Example output for the publisher: 


$ ./publisher -ORBSvcConf tcp.conf -DCPSConfigFile pub.ini
(20553|3086640832) Writer::start
(20553|3027631024) Writer::svc begins.
 13:55:31.995447 (20553|3027631024) Writer::svc starting to write.
(20553|3027631024) Writer::svc finished.
(20553|3086640832) Writer::end

Learning and Using DDS

You will be using the OpenDDS Data Distribution Service (DDS) implementation. Please reference the documentation there for downloading and setting up OpenDDS.

You will also need to download and install ACE and TAO. Please see the online documentation for information on how to setup your ACE and TAO development environment on EECS's computing system.

NOTE: There is also an example OpenDDS application in the OpenDDS distribution under $DDS_ROOT/DevGuideExamples/DCPS/Messenger. This example should be helpful if you're stuck on what OpenDDS calls to make in your code.


Concluding Remarks

This DDS assignment should fairly straightforward, though it illustrates the basic skills required to become adept at using DDS publish/subscribe middleware to developed distributed applications. Subsequent assignments will build on this assignment, so make sure you get it working correctly.


Back to CS 395-2 home page.