< Previous | Next >

Lesson 14: Add quality of service elements

In this lesson, you add quality of service elements to the Data Distribution Service for Real-Time Systems (DDS) application.

In this final lesson, you review the support for quality of service elements. IBM® Rational® Rhapsody® Developer for C++ supports modeling quality of services to all DDS entities except for DomainParticipantFactory, which is not part of the DDS profile. You can set the quality of service to DomainParticipantFactory by applying user source code into Rational Rhapsody Developer for C++ models.

In this lesson, you review how the deadline quality of service is applied to MyDataReader and MyDataWriter.

  1. Open the SubscriberDiagram diagram.
  2. On the Diagram toolbar, click the deadlineQosPolicy icon , and then click the diagram. Name the element MyDeadlineQos.
  3. Click the qualityOfService icon and draw a dependency line from the MyDeadlineQos element to the MyDataReader element, as shown in the following figure.
  4. Open the Features window for the MyDeadlineQos element. On the Tags tab, set the Period field to 2000, and then click OK. This value indicates an interval of 2 seconds (2000 milliseconds).
  5. Right-click the MyDeadlineQos element and select Copy.
  6. Paste the MyDeadlineQos element in the PublisherDiagram diagram.
  7. Create a qualityOfService dependency between the MyDeadlineQos element and the MyDataWriter element.
  8. If not already set, switch the active configuration to the MyPublishingApplication domain participant and regenerate it.
  9. Look at the code of MyPublisher: Right-click MyPublisher and select Edit Code. Look at the MyPublisher::initPublisher() function. The source code for setting the deadline quality of service for MyDataWriter was added.
  10. Switch the active configuration to the MySubscribingApplication domain participant and regenerate it.
  11. Look at the code of MySubscriber. In the MySubscriber::initSubscriber function, the source code for setting the deadline quality of service for MyDataWriter was added.
  12. Build MySubscribingApplication and run it. Then switch to MyPublishingApplication, build it and run it. The expected output for MySubscribingApplication is the same as the output in Lesson 12: Add code to receive updates about your topic. The output is similar because both dataWriter and dataReader elements agree on a deadline quality of service of 2 seconds, and according to the source code, the publisher updates MyTopic topic every 1 second (it calls the Sleep function with a 1 second argument).

Lesson checkpoint

In this lesson, you learned how to add quality of service elements to the DDS application.
< Previous | Next >

Feedback