User Guide Rational Rose RealTime Connexis
User Manual:
Open the PDF directly: View PDF .
Page Count: 384
Download | |
Open PDF In Browser | View PDF |
Rational Software Corporation User Guide RATIONAL ROSE® REALTIME CONNEXIS VERSION: 2002.05.00 PART NUMBER : 800-025101-000 WINDOWS/UNIX support@rational.com http://www.rational.com IMPORTANT NOTICE COPYRIGHT Copyright ©1993-2001, Rational Software Corporation. All rights reserved. Part Number: 800-025101-000 Version Number: 2002.05.00 PERMITTED USAGE THIS DOCUMENT CONTAINS PROPRIETARY INFORMATION WHICH IS THE PROPERTY OF RATIONAL SOFTWARE CORPORATION (“RATIONAL”) AND IS FURNISHED FOR THE SOLE PURPOSE OF THE OPERATION AND THE MAINTENANCE OF PRODUCTS OF RATIONAL. NO PART OF THIS PUBLICATION IS TO BE USED FOR ANY OTHER PURPOSE, AND IS NOT TO BE REPRODUCED, COPIED, ADAPTED, DISCLOSED, DISTRIBUTED, TRANSMITTED, STORED IN A RETRIEVAL SYSTEM OR TRANSLATED INTO ANY HUMAN OR COMPUTER LANGUAGE, IN ANY FORM, BY ANY MEANS, IN WHOLE OR IN PART, WITHOUT THE PRIOR EXPRESS WRITTEN CONSENT OF RATIONAL. TRADEMARKS Rational, Rational Software Corporation, Rational the e-development company, ClearCase, ClearCase Attache, ClearCase MultiSite, ClearDDTS, ClearQuest, ClearQuest MultiSite, DDTS, Object Testing, Object-Oriented Recording, ObjecTime & Design, Objectory, PerformanceStudio, ProjectConsole, PureCoverage, PureDDTS, PureLink, Purify, Purify'd, Quantify, Rational, Rational Apex, Rational CRC, Rational Rose, Rational Suite, Rational Summit, Rational Visual Test, Requisite, RequisitePro, RUP, SiteCheck, SoDA, TestFactory, TestFoundation, TestMate, The Rational Watch, AnalystStudio, ClearGuide, ClearTrack, Connexis, e-Development Accelerators, ObjecTime, Rational Dashboard, Rational PerformanceArchitect, Rational Process Workbench, Rational Suite AnalystStudio, Rational Suite ContentStudio, Rational Suite Enterprise, Rational Suite ManagerStudio, Rational Unified Process, SiteLoad, TestStudio, VADS, among others, are either trademarks or registered trademarks of Rational Software Corporation in the United States and/or in othercountries.All other names are used for identification purposes only, and are trademarks or registered trademarks of their respective companies. Microsoft, the Microsoft logo, Active Accessibility, Active Channel, Active Client, Active Desktop, Active Directory, ActiveMovie, Active Platform, ActiveStore, ActiveSync, ActiveX, Ask Maxwell, Authenticode, AutoSum, BackOffice, the BackOffice logo, BizTalk, Bookshelf, Chromeffects, Clearlead, ClearType, CodeView, Computing Central, DataTips, Developer Studio, Direct3D, DirectAnimation, DirectDraw, DirectInput, DirectMusic, DirectPlay, DirectShow, DirectSound, DirectX, DirectXJ, DoubleSpace, DriveSpace, FoxPro, FrontPage, Funstone, IntelliEye, the IntelliEye logo, IntelliMirror, IntelliSense, J/Direct, JScript, LineShare, Liquid Motion, the Microsoft eMbedded Visual Tools logo, the Microsoft Internet Explorer logo, the Microsoft Office Compatible logo, Microsoft Press, the Microsoft Press logo, Microsoft QuickBasic, MS-DOS, MSDN, Natural, NetMeeting, NetShow, the Office logo, One Thumb, OpenType, Outlook, PhotoDraw, PivotChart, PivotTable, PowerPoint, QuickAssembler, QuickShelf, Realmation, RelayOne, Rushmore, SourceSafe, TipWizard, TrueImage, TutorAssist, V-Chat, VideoFlash, Virtual Basic, the Virtual Basic logo, Visual C++, Visual FoxPro, Visual InterDev, Visual J++, Visual SourceSafe, Visual Studio, the Visual Studio logo, Vizact, WebBot, WebPIP, Win32, Win32s, Win64, Windows, the Windows CE logo, the Windows logo, Windows NT, the Windows Start logo, and XENIX are trademarks or registered trademarks of Microsoft Corporation in the United States and other countries. FLEXlm and GLOBEtrotter are trademarks or registered trademarks of GLOBEtrotter Software, Inc. Licensee shall not incorporate any GLOBEtrotter software (FLEXlm libraries and utilities) into any product or application the primary purpose of which is software license management. Portions Copyright ©1992-20xx, Summit Software Company. All rights reserved. PATENT U.S. Patent Nos.5,193,180 and 5,335,344 and 5,535,329 and 5,835,701. Additional patents pending. Purify is licensed under Sun Microsystems, Inc., U.S. Patent No. 5,404,499. GOVERNMENT RIGHTS LEGEND Use, duplication, or disclosure by the U.S. Government is subject to restrictions set forth in the applicable Rational Software Corporation license agreement and as provided in DFARS 277.7202-1(a) and 277.7202-3(a) (1995), DFARS 252.227-7013(c)(1)(ii) (Oct. 1988), FAR 12.212(a) (1995), FAR 52.227-19, or FAR 227-14, as applicable. WARRANTY DISCLAIMER This document and its associated software may be used as stated in the underlying license agreement. Rational Software Corporation expressly disclaims all other warranties, express or implied, with respect to the media and software product and its documentation, including without limitation, the warranties of merchantability or fitness for a particular purpose or arising from a course of dealing, usage, or trade practice. Contents Preface i Road Map ii Related Documentation ii How to Get Help iii When contacting Rational technical support iii Rational web site iii Other Resources iii Contacting Rational Technical Publications iv Contacting Rational Technical Support iv Chapter 1 Rational Connexis Overview 5 Key Benefits of Connexis 5 Connexis Leverages Proven Standards 6 Connexis is Tightly Integrated with Rose RealTime 6 Connexis Provides Access Transparency 7 Connexis Provides Location Transparency 7 Connexis is Very Flexible and Easily Configurable 8 Connexis Provides Support for Testing Distributed Applications 9 Connexis is Designed to be Fault-tolerant and Reliable 9 Connexis Terminology and Definitions 11 User Guide - Rational Rose RealTime Connexis v Connexis Application Layers 13 UML Application 14 Ports in Rose RealTime 14 Distributed Connection Service 16 Transport 16 Locator Service 17 Using the locator 17 The HelloWorld Model 18 Running the HelloWorld Model 18 Additional HelloWorld Models 19 HelloWorldHotStandby 19 HelloWorldLoadSharing 19 HelloWorldOverflowToBackupService 19 HelloWorldRedundantLocator 20 Using Connexis 20 Chapter 2 Using Connexis Model Examples 21 The BasicTest Model 21 The Quick Start Model 22 Quick Start Iteration 1 Model 22 Quick Start Iteration 2 Model 22 The HelloWorld Model 23 Running the HelloWorld Model 23 Additional HelloWorld Models 24 HelloWorldHotStandby 24 HelloWorldLoadSharing 24 HelloWorldOverflowToBackupService 24 HelloWorldRedundantLocator 25 The DCS Performance Model 25 Running the Performance Model 25 Performance model server output 27 Performance model client output 28 vi User Guide - Rational Rose RealTime Connexis Chapter 3 Quick Start 31 Quick Start Overview 31 Iteration 1: Creating the Rose RealTime Model 35 Step 1: Create a New Model 35 Step 2: Create Packages for the Model 35 Step 3: Create the Ping, Pong, and ContainerCapsules 38 Step 4: Create the PingPong Protocol Class 40 Step 5: Build the Structure of the Model 43 Step 6: Implement the State Machines for Ping and Pong 48 Step 7: Build and Test the Model 53 Iteration 2: Connexis Enabling our Application 59 Step 1: Remove the Connector Between the pingPong Ports 59 Step 2: Make Changes to Pong’s pingPong Port 60 Step 3: Make Changes to Ping’s pingPong Port 61 Step 4: Adding DCS Layer Notification to the Ping and Pong Capsules 63 Step 5: Modify Ping’s State Machine to Wait for Connexis 64 Step 6: Modify Pong’s State Machine to Wait for Connexis 65 Step 7: Modify Ping’s State Machine to Wait for Notify 66 Step 8: Add Registration Code to the Ping and Pong Capsules 67 Step 9: Add the Connexis Configuration Capsules to Your Model 69 Step 10: Create and Configure the Ping Component 74 Step 11: Create and Configure the Pong Component 75 Step 12: Add Component Dependencies 77 Step 13: Build and Execute the Models 79 Basic Connexis Development Approach Summary 82 Chapter 4 Adding Connexis Support to Your Model 83 Sharing DCS Interfaces 84 Sharing DCS Interfaces into your Model 84 Removing Shared Packages 85 User Guide - Rational Rose RealTime Connexis vii Configuring Connexis Capsules 85 Manually Integrating Transports Into a Model 88 Configuring a Component for Connexis 90 Verifying Connexis Enabled Components 91 Initializing Your Connexis Capsule 92 Using the RTDInitStatus Protocol 93 Using Fixed Initialization Order 98 Converting Connexis Version 2000.02.10 Models to Connexis 2001A.04.00 Models 99 Verifying Component Compatibility with Connexis Version 2001A.04.00. 103 RTDErrorType Error Reporting 104 Chapter 5 Establishing Connections 107 General Connection Patterns 108 Client/Server 108 Peer to Peer 109 Unwired Port Registration 110 What is Registration? 111 Port API 112 Automatic vs. Application Registration 113 Registration Parameters 115 Name Resolution 118 Connexis Connection Options 118 Local Connections 119 External Explicit Connections 124 External explicit examples 124 Locator Connections 125 Registration Summary 127 Scenario 1: Publisher Registered with the ILS 127 Scenario 2: Publisher Registered with the DCS 128 Scenario 3: Publisher Registered with the Locator 130 Multiple Publishers 131 viii User Guide - Rational Rose RealTime Connexis Connection Design Heuristics 131 When to Use Replicated Publisher Ports 131 Use of Invokes 132 Use of Broadcast Sends 132 Use of Notification 133 Use of Defers 133 Sending Data 134 Sending Data Classes by Value 134 Chapter 6 Using the Connexis Locator Service 135 Adding Locator Support to a Model 136 Publication and Subscription 136 Publication 136 Subscription 137 Ranking Published Ports 137 Load-sharing of Publishers 138 Examples 138 Locator Dynamics 140 Fully Subscribed Publishers 141 Subscriber Losing Connection to a Publisher 142 Locator Failure 142 Locator Race Condition 144 Unconnected Subscribers 145 Locator Configuration 145 Locator Parameters 145 Locator Parameter Examples 149 Creating your Own Name Service 150 Chapter 7 Using the Connexis Viewer 151 Viewer Architecture 153 Adding Viewer Support to a Model 153 Adding Metrics Support to a Model 154 User Guide - Rational Rose RealTime Connexis ix Starting the Connexis Viewer 155 Duplicate CNX Unique Identifiers 156 Viewer Main Window 156 Viewer Menus 158 File Menu 158 View Menu 158 Tools Menu 159 Windows Menu 161 Help Menu 161 Explorer Tree View 162 Processor Icons 163 Component Instance Icons 163 Filter Icons 164 Component Instance Status 164 Named Services Icons 165 Port Icons 165 Virtual Circuit Icons 166 Object Information Column 167 Popup Menus 168 Session Popup Menu 168 Processor Popup Menu 169 Component Instance Popup Menu 170 Port Reference Popup Menu 173 Virtual Circuit Popup Menu 174 Creating Processors and Component Instances 175 Adding a Processor 175 Changing the Properties of a Processor 176 Removing a Processor 177 Adding a Component Instance 177 Changing the Properties of a Component Instance 180 x User Guide - Rational Rose RealTime Connexis Performing Event Tracing 182 Defining a Trace Filter for a Component Instance 182 Setting trace filters 185 Defining a Port Reference Trace 188 Defining a Virtual Circuit Trace 192 Trace Window 194 Component Instance Trace Window 194 Virtual Circuit Trace Window 195 Trace Window Popup Menu 196 Show trace data 197 Define trace 199 Trace active 199 Select in tree 199 Clear 199 Save trace 199 Trace Header Context Menu 201 Generating Interaction Diagrams from Trace Output Files 202 Reporting of error messages 206 Log Window 206 Displaying the Metrics Collection 207 Starting Metrics Collection 208 Using the Metrics Window 208 Summary metrics collection 210 Detailed metrics collection 214 Messages metrics collection 216 Audits metrics collection 219 Engineering metrics collection 221 DCS errors metrics collection 225 Application errors metrics collection 228 Application incompatibility metrics collection 232 Stopping Metrics Collection 234 Saving Collected Metrics 234 User Guide - Rational Rose RealTime Connexis xi Viewer Tips and Usage Notes 234 Capturing Pre-Viewer Session Messages 234 Error and Warning Tracing 235 Software errors 235 Software warnings 235 Maximizing Viewer Responsiveness 235 Chapter 8 Using the Connexis Metrics Service 237 Obtaining Metrics Data with a Metrics Service 237 Enabling Metrics in the DCS library 238 Adding a Metrics Port 238 Subscribing to the Metrics Service 238 Collecting and Processing Metrics 239 Using Metrics and the Connexis Viewer 243 Chapter 9 Registration String Grammar 245 Registration String Grammar for DCS Registrations 245 Chapter 10 Connexis Command Line Options 247 Component Instance with Fixed Endpoints (no locator service) 247 Component Instance using CDM Endpoint, Locator using CDM 248 Component Instance using CDM and CRM Endpoints, Primary Locator using CDM, Backup Locator using CRM 249 Component Instance with CDM and CRM, CRM is Preferred Transport 250 Miscellaneous Command Line Options 250 Chapter 11 Connexis Messages, Errors, and Warnings 255 Initialization Messages 255 Initialization Errors 257 Parameter Errors 257 xii User Guide - Rational Rose RealTime Connexis Chapter 12 Connexis Customization Reference 261 Engineering Rules Overview 262 Thread Configuration 262 Process view of a Connexis application 263 Default number of threads 264 The application layer 265 DCS and transport Layer 265 Buffer Configuration 266 Overall buffer configuration of a Connexis application 266 Application layer 267 DCS layer 268 Connexis buffer usage 270 Configuring the Number of Virtual Circuits 271 Verifying Connections 272 Handshake audit 272 Connection audit 273 Reset audit 273 Command Line Options Reference 274 Setting Command Line Options 274 System wide 275 DCS options 277 Transporter options 278 Transport specific options 282 CDM 285 Locator 286 Connexis viewer/target agent 287 Chapter 13 Customizing and Porting DCS Libraries 289 Common customizations for the DCS 289 Other resources 290 Operating system capabilities 290 What to do before calling Rational support 290 Porting the DCS to a New Target Configuration 290 Creating a New TargetRTS Library 291 Creating DCS Target Specific Header Files 292 Loading the DCS Model 293 Creating a C++ Library Component 293 Configuring the C++ Library Component Settings 294 User Guide - Rational Rose RealTime Connexis xiii Configuring the CDR Encode/Decode Functionality 296 Creating a Minimal DCS Library Configuration 296 Building the Library 297 Testing the Port 297 Chapter 14 Using the Transport Integration Framework 299 Transport Integration Overview 300 DCS Architecture 301 Terminology 302 Connection Lifecycle 303 DCS Threading Model 304 Understanding your Transport 305 Determine the Name of your Transport and Protocols 306 Decide the String Format of the User-specified Address 306 Decide How to Validate the Address 306 Decide the Transformation of the Address 307 Determine the Internal Representation of your Address 308 Decide the Format of the Listening Point Information 309 Decide if your Transport is Blocking or Non-blocking 309 Decide the Recommended Address Resolution Configuration 310 Decide How the Transport will Recover from Transport Failures 311 Decide How to Audit your Transport 311 Decide the Format of your Messages 312 Decide Strategy for Listening for Messages 313 Integrating your Transport 315 Setting up the Model 315 Understand the Integrated Transport 316 Implementing the RTDTransportAddressFactory Subclass 316 Implementing the RTDTransportAddress Subclass 317 Implementing the RTDTransportEndpointFactory Subclass 318 Implementing the RTDTransportEndpoint Subclass 319 Implementing the RTDTransport Subclass 320 xiv User Guide - Rational Rose RealTime Connexis Building the Transport Integration 321 Packaging the Transport Integration 321 Using the Transport Integration in Another Model 322 Testing the Transport Integration 322 TIF Classes 322 RTDTransportAddress 325 Constructors 327 RTDTransportEndpointFactory 331 RTDTransportEndpoint 332 Constructor 333 RTDTransport 339 RTDTIF 341 RTDTransportProfile 341 RTDConnexisAPI 348 Appendix A Index Comparison of TCP/IP and UDP/IP 355 357 User Guide - Rational Rose RealTime Connexis xv xvi User Guide - Rational Rose RealTime Connexis Preface This document is organized so that each chapter is as stand-alone as possible. This section provides a brief overview of the content of each chapter and several reading paths through the document based on reader knowledge. “Rational Connexis Overview” on page 5, provides a brief introduction to Connexis, the solutions that it provides and its primary features. “Quick Start” on page 31, provides a simple Connexis tutorial. This tutorial is also useful for those who are new to Rose RealTime. “Adding Connexis Support to Your Model” on page 83 describes how to add Connexis support to your Rose RealTime model. “Establishing Connections” on page 107, elaborates on the concepts presented in the Overview chapter. This chapter describes the different ways of creating connections using Connexis, the syntax for describing Connexis endpoints and the parameters that can be supplied as part of registering connection endpoints. “Using the Connexis Locator Service” on page 135, describes the Connexis Locator Service and how to configure it to run in a distributed application. “Using the Connexis Viewer” on page 151, describes the Connexis Viewer and how to configure it to view a distributed application. “Using the Connexis Metrics Service” on page 237 describes how to collect DCS statistics from within a Rose RealTime executable model. “Registration String Grammar” on page 245 provides information on the Backus-Naur Form (BNF) Grammar for the registerSAP and registerSPP commands. User Guide - Rational Rose RealTime Connexis i Preface “Connexis Command Line Options” on page 247 provides command line examples for commonly-used Connexis configurations. “Connexis Messages, Errors, and Warnings” on page 255 provides information to assist users in developing and debugging their models. “Connexis Customization Reference” on page 261, describes the different configuration options that can be used to customize how Connexis works. “Customizing and Porting DCS Libraries” on page 289, describes the Distributed Connection Service and explains how to customize or port DCS libraries to a new target environment. “Using the Transport Integration Framework” on page 299, describes the Connexis Transport Integration Framework and how to integrate common or customized transport in a distributed application. “Comparison of TCP/IP and UDP/IP” on page 355, provides background information about TCP/IP and UDP/IP. Road Map People who are new to Rose RealTime should review the Rose RealTime documentation followed by the Overview and Quick Start chapters of this document. People who are new to Connexis, should read the Overview and Quick Start chapters before any other part of the manual. If you are already familiar with Rose RealTime and have a good understanding of the problems that Connexis solves, you may want to start with Establishing Connections, and refer to the Overview chapter only when terms or concepts are unfamiliar to you. Related Documentation The following is a list of documentation that is related to the Connexis product. ii ■ Rose RealTime online Help and user documentation. This documentation is available online with the Rose RealTime product. ■ ISO/IEC 10746-1 ODP Reference Model Part 1. This specification details the challenges and potential solutions to distributed computing. User Guide - Rational Rose RealTime Connexis How to Get Help How to Get Help This section describes procedures for interacting with Rational Software Corporation's technical support services. When contacting Rational technical support When contacting technical support for Rose RealTime, please be prepared to supply the following information: ■ Name, telephone number, and company name. ■ Product version number (found in the viewer’s Help > About dialog). ■ Computer make and model. ■ Make and version of the operating system. ■ Make and version of development tools (configuration management program, compiler, linker, RTOS, requirements management program). ■ Your log number (if you are calling about a previously reported problem). If your site has a designated, on-site support person, please try to contact that person before contacting Rational technical support. Rational web site You can contact technical support and obtain the latest product information through our web site at: http://www.rational.com/products/rosert Other Resources ■ Online Help is available for Rational Rose RealTime. Select an option from the Help menu. All manuals are available online, either in HTML or PDF format. To access the online manuals, click Rose RealTime Online Documentation from the Start menu. ■ For more information on training opportunities, see the Rational University Web site: http://www.rational.com/university. User Guide - Rational Rose RealTime Connexis iii Preface Contacting Rational Technical Publications To send feedback about documentation for Rational products, please send e-mail to our Technical Documentation Department at techpubs@rational.com . Contacting Rational Technical Support If you have questions about installing, using, or maintaining this product, contact Rational Technical Support. Your Location Telephone Fax E-mail North America (800) 433-5444 (toll free) (781) 676-2460 Lexington, MA support@rational.com (408) 863-4000 Cupertino, CA Europe, Middle East, Africa +31 (0) 20-4546-200 Netherlands +31 (0) 20-4546-202 Netherlands support@europe.rational.com Asia Pacific +61-2-9419-0111 Australia +61-2-9419-0123 Australia support@apac.rational.com Note: When you contact Rational Technical Support, please be prepared to supply the following information: iv ■ Your name, telephone number, and company name ■ Your computer’s make and model ■ Your computer’s operating system and version number ■ Product release number and serial number ■ Your case ID number (if you are following up on a previouslyreported problem) User Guide - Rational Rose RealTime Connexis Chapter 1 Rational Connexis Overview Rational Connexis is a Rational Rose for RealTime add-in product that provides connectivity for Unified Modeling Language (UML) models. Connexis is tightly integrated with Rose RealTime and is highly optimized for event-driven asynchronous systems. Connexis improves an application’s time to market by eliminating the need to design, develop, and test a custom Inter-Process Communications (IPC) mechanism. The use of a Commercial Off The Shelf (COTS) distribution component, such as Connexis, simplifies and de-risks the design and deployment of distributed systems. Key Benefits of Connexis In addition to the time to market advantage of using Connexis, there are also several technical advantages to using Connexis. These are listed below and will be discussed in more detail in the following sections: ■ Connexis Leverages Proven Standards ■ Connexis is Tightly Integrated with Rose RealTime ■ Connexis Provides Access Transparency ■ Connexis Provides Location Transparency ■ Connexis is Very Flexible and Easily Configurable ■ Connexis Provides Support for Testing Distributed Applications ■ Connexis is Designed to be Fault-tolerant and Reliable User Guide - Rational Rose RealTime Connexis 5 Chapter 1 Rational Connexis Overview Connexis Leverages Proven Standards Connexis is built upon current industry-standard technologies. Connexis supports sending UML-defined data classes between Rose RealTime models running in different processes and lets you integrate proven transports using the Connexis Transport Integration Framework. As shown in Figure 1, Connexis Datagram Messaging (CDM) is designed on top of UDP and Connexis Reliable Messaging (CRM) is designed on top of TCP. Connexis also supports custom messaging transports, allowing your applications to support native communication protocols to improve service. Figure 1 Connexis Architecture Connexis is Tightly Integrated with Rose RealTime The Connexis product is tightly integrated with Rose RealTime. Adding Connexis support to a Rose RealTime model simply involves sharing Connexis packages, adding Connexis capsule roles to the model, and configuring components for your application. Transports that are integrated into Connexis are available to the application in the same manner as standard Connexis transports. Using transports provided by Connexis and using integrated transports are very similar. Once you have used one, you can use any other. 6 User Guide - Rational Rose RealTime Connexis Key Benefits of Connexis If you know how to use Rose RealTime, learning how to use Connexis is easy. Connexis ports are unwired ports in your Rose RealTime model that you register with the Target RSL using a Connexis registration string. The only concept that is new to a Rose RealTime user is the format of the Connexis registration string. Once the ports are registered, sending and receiving messages on them occurs in the exact same way as it does in a UML model that does not use Connexis. Connexis Provides Access Transparency The flexible encoding and decoding strategy that is used by Connexis allows Connexis to work on different types of hardware environments. The endian of the target environment is transparent to the executing application. Connexis Provides Location Transparency The Connexis Locator service provides location transparency for a distributed application. The application uses service names to refer to the endpoints that are being connected. As a result, the physical address of these endpoints never has to be revealed to the application. Locator features are available for services published on integrated transport addresses. Connexis also supports many different distribution options which allow the design of the application to be very flexible. The following are the most common types of connections supported: ■ Local connections Connexis supports local connections which are optimized to be as efficient as directly wired ports. The endpoints of the local connections are registered using service names and Connexis takes care of binding the endpoints together. Once bound, these local connections have the same performance characteristics as two wired ports that have been bound together. ■ Explicit endpoint connections Connexis accepts registrations that use explicit endpoint addresses in the registration string. This can be used if the application knows the processor location of the services that it wants to access. In this way a client can bind to a service using the explicit processor location and the service name of the desired service. User Guide - Rational Rose RealTime Connexis 7 Chapter 1 Rational Connexis Overview ■ Locator connections The Connexis Locator service can be used to find a service (given the service name) anywhere in the distributed application. Once the Locator has been started, one side of the connection registers with it as the publisher, and the other side registers as the subscriber. The Connexis Locator finds the appropriate endpoints, and feeds them back to the connection service which establishes the connection. Connexis is Very Flexible and Easily Configurable Connexis supports a wide range of configuration options. This enables the engineering of Connexis to be very flexible and adaptable to different target environments. Configuration options are available to: ■ configure connection audits ■ adjust buffer counts and sizes ■ adjust thread priorities and stack sizes ■ adjust message delivery timing characteristics The Target Agent, which interfaces to the Connexis Viewer, and the Connexis Locator Service do not have to be a part of every Connexis application. If your application does not use the Locator and you do not need access to the Connexis Viewer, these components can be left out of the node’s configuration. This helps minimize the size of the Connexis code that gets linked in your application. For more information about the Connexis Viewer refer to “Using the Connexis Viewer” on page 151. For more information on the Connexis Locator Service refer to “Using the Connexis Locator Service” on page 135. Connexis allows multiple ports to be registered with the same service name. This, coupled with the normal Rose RealTime feature of port multiplicity, enables several simple distribution patterns to be supported automatically by Connexis. Patterns that are not directly supported can usually be implemented very easily in Rose RealTime. Connexis is shipped with full source. The library can be rebuilt if needed for a custom environment configuration. 8 User Guide - Rational Rose RealTime Connexis Key Benefits of Connexis Connexis Provides Support for Testing Distributed Applications One of the tools that comes with Connexis is the Connexis Viewer. The Connexis Viewer allows developers to attach to running Connexis applications and to graphically view connections as they are being established and taken down. The Viewer provides a minimallyintrusive tracing mechanism that allows you to trace messages that are being sent and received by any of the endpoints in a distributed application. The Viewer also receives messages from integrated transports and collects metrics information. The traditional method of testing a distributed Rose RealTime application is to attach a probe on each end of a virtual circuit to make sure that the connection has been established. This method of testing does not scale well. In large systems, it is very difficult to know where the other end of a virtual circuit is in the model (consider systems with replicated publishers or multiple publishers with the same name). The Connexis Viewer simplifies the monitoring of distributed connections. The Viewer also has the ability to import the deployment diagram from a Rose RealTime model so that the information about the distributed application does not have to be entered in two places. The Rose RealTime target observability feature can also be used to trace message flow on unwired Connexis ports. The Connexis installation provides DCS libraries that are compiled with debugging capabilities for the Connexis Viewer and the Target Observability feature of Rose RealTime. This library configuration makes the initial debugging of distributed applications easier. As the application becomes more mature, consider building a minimal configuration of the DCS libraries for your target configuration. Building a minimal configuration is described in “Customizing and Porting DCS Libraries” on page 289. Connexis is Designed to be Fault-tolerant and Reliable Fault tolerance and reliability are paramount to most real-time systems. Connexis has been designed with these requirements in mind. The following is a list of the different Connexis features that enhance the fault tolerance and reliability of Connexis: ■ The Locator Service can be run in simplex or duplex mode. A binary elector is used to determine the health of the primary locator. User Guide - Rational Rose RealTime Connexis 9 Chapter 1 10 Rational Connexis Overview ■ Connexis has been designed with true non-blocking behavior. All potentially blocking system calls are handled by a userconfigurable set of helper threads. Name resolving is an example of an operation that makes use of helper threads. ■ A heart beat style audit is used over the UDP datagram based connections to detect connection / process / processor failure. This audit is tunable so that it can be used in a variety of environments. The audit is highly efficient since it monitors user messages to collect status information. This allows the explicit “Are you Alive” messages to be suppressed. When explicit “Are You Alive” messages are used, the number of such messages sent per unit of time can be capped to ensure that audits do not overutilize system resources. When a connection-oriented protocol (such as TCP) is used, only a very basic, “is the connection alive,” protocol is used. ■ Buffering policies can be configured between the UML asynchronous messaging controller and the flow-controlled transport message router. This ensures that your model never hangs due to a slow or broken transport connection. When the queue fills up, messages are properly deleted from the system. ■ It is easy to build a set of components that meet application specific requirements for fault-tolerance and reliability. A pair of generic signals, rtBound and rtUnbound, are supported for all Rose RealTime and Connexis ports. Notification can be enabled on a per-port basis and utilized by the application with minimal additional complexity. ■ The underlying “try-forever” algorithm can be overridden by the application simply by deregistering the unwired port when quality of service parameters are not met. ■ Patterns for distribution can be implemented using Connexis as the underlying distribution mechanism. For example, a single publisher can actually hide multiple distributed connections to a replicated service. ■ Resource limits can be placed on publishers of services to limit the number of subscribers per publisher. ■ The allocation of unwired ports to capsules is under the control of the designer and since the incarnation of capsules onto threads is also under control of the application, the application can dynamically control which resources are being used. User Guide - Rational Rose RealTime Connexis Connexis Terminology and Definitions ■ Services can be ranked according to the preferred order of use. This ranking is done with full, dynamically updated knowledge of the resource limits. If a given service is full, one of a lower rank will be used if available. ■ Configurable system audits verify that the internal system connection state matches across the entire system. Connexis Terminology and Definitions Table 1 lists and defines Connexis and UML terms and acronyms. Table 1 Definitions Term Definition CDM Connexis Datagram Messaging. A thin layer on top of UDP that provides additional support for connection auditing and quality of service parameters. CRM Connexis Reliable Messaging. A thin layer on top of TCP that provides additional support for connection auditing and quality of service parameters. DCS Distributed Connection Service. This is the key component used for connecting and managing the different parties in a connection. DNS Domain Name System (or Service), an Internet service that translates domain names into IP addresses. Because domain names are alphanumeric, they are easier to remember; however, the Internet is really based on IP addresses. Every time you use a domain name, a DNS service must translate the name into the corresponding IP address. For example, the domain name www.example.com might translate to 198.105.232.4. duplex locator service Refers to a configuration in which there are two locators. In normal operation, one locator acts as the active locator and the other acts as the standby locator. This configuration is used to prevent a locator from being a single point of failure. endpoint An endpoint is an explicit network address used for finding a peer object. It consists of a protocol followed by a colon, followed by a protocol-address. For example: cdm://ipaddress:port. User Guide - Rational Rose RealTime Connexis 11 Chapter 1 Rational Connexis Overview Table 1 12 Definitions Term Definition ILS Internal Layer Service. This is the connection service that is built into Rose RealTime. It can only be used for establishing intra-process connections. IPC Inter -Process Communication. This is a broad term that is being used to describe any mechanism that is used to share information between processes. This could be something as simple as shared memory or something as sophisticated as CORBA. Locator The Connexis Locator Service is a configurable service that is used to look up the physical location of an object given a service name for that object. notification The term used to describe the process of sending a message to a capsule to inform it when one of its ports has been connected to, or disconnected from, its peer. SAP Service Access Point. Term used to describe an unwired port that is participating in a connection as the subscriber. The SAP acronym appears in portions of the Run-time Service Library’s API. simplex locator service Refers to a configuration in which there is only one locator. This configuration does not provide redundancy. See also “duplex locator service.” SPP Service Provisioning Point. Term used to describe an unwired port that is participating in a connection as the publisher. The SPP acronym appears in portions of the Run-time Service Library’s API. tagged-values Term used to represent the parameters that are being passed to the Connection Service when registering an unwired port. Target RSL Target Run-time System Libraries. These are the libraries that are compiled into a Rose RealTime model and that implement the messaging, state walking, and timing service (among other services) of a Rose RealTime model. TCP/IP Transmission Control Protocol / Internet Protocol. Connection-based transport protocol. Transport The underlying protocol that is being used to pass data between communicating objects. User Guide - Rational Rose RealTime Connexis Connexis Application Layers Table 1 Definitions Term Definition A framework that lets 3rd parties (including developers) Transport add additional transports for use in Connexis Messaging. Integration Framework (TIF) UDP User Datagram Protocol. Connectionless transport protocol. UML Unified Modeling Language. An industry-standard modeling language used to model object-oriented software systems. UML is used by Rose RealTime and Connexis to model the software that is being built. unwired port An unwired port is a UML object that can have connections specified using registration names. These names can be specified at either design time or run-time. virtual circuit A virtual circuit is the term used to refer to a connection that has been established between two endpoints. This refers to a connection between a single subscriber and a single publisher. wired port A wired port is a UML object that can have an explicit connection (to another wired port) specified at design time. The connection will be established at system initialization time or at run-time if the port is contained in a capsule that is optional or plug-in. Connexis Application Layers Connexis allows multiple Rose RealTime-generated executables to be connected in a robust and reliable manner. Executables are networked by connecting unwired ports across processor boundaries. The Connexis programming model provides significant value: ■ built for real-time - automatic mapping of UML communication ports onto a high-performance software backplane ■ product-ready, but flexible - the software is ready to run as soon as it has been installed but can be adapted to handle project-specific requirements User Guide - Rational Rose RealTime Connexis 13 Chapter 1 Rational Connexis Overview ■ simple-to-use programming model - supports client/server type name binding and asynchronous messaging ■ support for fault tolerance - detects failures and provides a framework for dealing with faults A Rose RealTime application that is using Connexis to implement its inter-process communication has the high-level architecture shown in Figure 2. The control paths that are shown, indicate the components that are involved in registering and deregistering endpoints in the UML application. All data that is sent between endpoints in a Connexisenabled application goes through the Transport component. Figure 2 High level view of a Connexis enabled application UML Application This section presents an overview of how Connexis is used from within Rose RealTime. For more information on Rose RealTime refer to the “Rational Rose RealTime Toolset Guide.” Ports in Rose RealTime In Rose RealTime, ports are used to send messages between the capsules in your model. Rose RealTime has several different kinds of ports. The most common type of port is a wired port as shown in Figure 3. Wired ports are visibly connected to other wired ports in Rose RealTime models. Wired ports are represented graphically with two connected squares in the oval part of the port icon. 14 User Guide - Rational Rose RealTime Connexis Connexis Application Layers Figure 3 Connecting wired ports Another type of port that can be used in Rose RealTime is the unwired port. Unwired ports are the primary method for establishing Connexis connections. Once you have created an unwired port, you can specify the connection service, protocol, and endpoint address that it will use by registering the port with the Target RSL. This registration can either be done automatically or through application code. The Connection Service box in Figure 4 corresponds to the Distributed Connection Service box in Figure 2. The DCS is one implementation of a Connection Service. Figure 4 Connecting unwired ports A more detailed discussion on the registration process is provided in “Establishing Connections” on page 107. User Guide - Rational Rose RealTime Connexis 15 Chapter 1 Rational Connexis Overview Distributed Connection Service The Distributed Connection Service (DCS) is the connection service that is provided with Connexis. It is responsible for maintaining information about the unwired ports that have been registered with it by a UML model. The DCS is the part of the system that is responsible for establishing connections between unwired ports. It does this by parsing the registration strings that are passed in when an unwired port registers with the Target RSL. Transport The Transport is the component that is responsible for sending and receiving data between processes. It manages any incoming or outgoing data buffers and encodes and decodes data. A more detailed break-down of the Transport component is shown in Figure 5. Figure 5 16 Inside the Transport component User Guide - Rational Rose RealTime Connexis Connexis Application Layers Locator Service Another key component of a robust distributed system is a faulttolerant name service. A name service is used to find the actual location of a server given a predetermined service name. A well-known example of a name service is the Domain Naming Service (DNS) that is widely used on the Internet. The principle function of a name service is to look up a specific address when it is given a service name. This isolates the calling application from changes in the physical addressing of network components. In the Connexis product, the Locator Service provides the name service functionality. The Locator Service actually does a bit more than just operate as a name server. The Locator can be configured to arbitrate between more than one endpoint that provides the same service and it can also be set up to run in duplex mode, which allows a backup Locator to automatically take over when the primary fails. Using the locator An endpoint is defined to be the combination of a transport protocol and the address of a specific port in a distributed application. For example, cdm://address:port. If an explicit endpoint is provided, then the client will try to connect to the server at the specified endpoint. If a complete endpoint is not provided then the Locator is contacted. The Locator returns an endpoint that is then used by Connexis to choose the appropriate service provider or peer. The service name by which an endpoint is referred, is specified as part of the registration of that endpoint. The Connexis Locator Service supports both a primary and a backup locator. In this way, a distributed application can be made more robust by ensuring that there is no single point of failure in the name server. User Guide - Rational Rose RealTime Connexis 17 Chapter 1 Rational Connexis Overview The HelloWorld Model The HelloWorld model implements a simple distributed model using Connexis. The model demonstrates the use of the Connexis Locator Service and how it can be used to easily provide backup service in a distributed environment. The model contains two servers, a client, and the Connexis locator service, each running independently. The servers speak different languages (either English, or French). Initially, the client is bound to the server that comes up first. Once bound, the client makes requests to the server and the server sends back a greeting in the language it speaks. If the server to which the client is bound becomes unavailable, the client is notified of the connection loss, and it rebinds to the backup server, which starts responding to the client requests in the language it speaks. For example, if the client is initially bound to the English server, it will start receiving greetings in English. If you then terminate the English server (for example, resetting through the RTS panel), the connection will be lost momentarily, the client will be rebound to the French server, and the client will start receiving the greetings in French. Note: The greetings are output to the DOS window (Windows) and the RTS Output window (Solaris), which comes up when the client is started. Running the HelloWorld Model The model can be run on all supported host platforms. To run the application, start up the matching (for example, VC++6.0) set of locator, client, EnglishServer and FrenchServer component instances. 18 ■ Keep the DOS (Windows) or RTS Output (Solaris) window for the client in view. The other DOS or RTS Output windows can be minimized to reduce screen clutter. ■ Run all the component instances from the corresponding RTS panels. User Guide - Rational Rose RealTime Connexis The HelloWorld Model ■ If you run the EnglishServer first, you should see “Hello World!!!” appear on the client DOS window repeatedly. At this point, you can terminate the EnglishServer instance by means of the RTS panel. The client will receive a connection loss, and will then switch over to the FrenchServer as soon it is rebound via the locator service. You should now start to see "Salut le monde!!!" displayed in the client DOS window. Additional HelloWorld Models The following models are extensions of the HelloWorld model. They provide examples of distributed load-sharing and fault-tolerant patterns. HelloWorldHotStandby A client connects to two servers through a proxy actor, and continually sends greeting requests. The proxy forwards the message to both servers, and both of the servers respond back to the proxy, which in turn relays the message from the active server to the client. If there is no response from the active server within a specified time period, the other server becomes active, and starts to handle all the client requests. HelloWorldLoadSharing This model consists of two servers (an English and a French one) that supply greeting messages for multiple clients. The clients connect to the servers in a round-robin fashion. For example, if you had four clients, the first and the third client would connect to one server and the second and the fourth client would connect to the other server. HelloWorldOverflowToBackupService This model contains two servers (an English and a French one). One of the servers is given a higher rank so that it acts as the primary server. The clients connect to the primary server until the primary server has reached its full capacity. Any subsequent clients will connect to the backup server, which will handle their greeting requests for those clients. User Guide - Rational Rose RealTime Connexis 19 Chapter 1 Rational Connexis Overview HelloWorldRedundantLocator The model consists of one server, multiple clients, and a primary and a backup locator. The clients connect to the server using the primary locator. The server, in turn, provides greeting signals for the clients. If the primary locator is shut down, all subsequent client-server connections will be established using the backup locator. Using Connexis There are several steps that must be taken to add Connexis support to a model. These are: ■ share the RTDInterface package ■ add Connexis component capsule roles to appropriate capsules in the model ■ integrate transport protocols ■ configure components for your application Note: The Connexis configuration dialogs on ports and capsules allow the user to perform these steps as well. In addition to these steps, there are also general design rules that must be followed to ensure that the Connexis components have been initialized properly before they are used. Refer to “Adding Connexis Support to Your Model” on page 83 for more information on Connexis-enabling your application. 20 User Guide - Rational Rose RealTime Connexis Chapter 2 Using Connexis Model Examples With Connexis, four model examples are included to accelerate your learning and proficiency. The list of models are outlined below: ■ The BasicTest Model can be used to verify your environment. ■ The Quick start Model runs you through an introductory tutorial. ■ The HelloWorld Model presents a simple distributed model. ■ The Performance Model lets you evaluate the performance of Connexis-enabled models in your environment. By default, components in these model examples specify ‘localhost’ (127.0.0.1) as the host machine. If you want to run the model examples remotely (that is, on a specific processor rather than the one you are on), you must modify the model examples first. The BasicTest Model The BasicTest model implements a very simple client server distributed system and is intended for use as a simple model to test proper Connexis installation and operation on any of the Connexis-supported platforms. All hosts and target configurations supported with your Connexis installation are provided. To run the model on one of the supported configurations listed above, see “Verifying your installation using BasicTest, in the Release Notes and Installation Guide for Rational Rose RealTime Professional. User Guide - Rational Rose RealTime Connexis 21 Chapter 2 Using Connexis Model Examples The Quick Start Model The “Rational Connexis User Guide” provides a Quick start tutorial (chapter 2) to allow you to quickly come up to speed on using Connexis. The tutorial is composed of three iterations. Iteration 1 takes you through building a simple ping pong model using Rose RealTime. Iteration 2 takes you through the steps required to Connexis-enable the ping pong model and make it distributed. For your reference, complete, documented models for each iteration are provided as part of the model examples provided with Connexis. These examples can be run on all supported host platforms. For detailed instructions on using the Quick Start model, see “Quick Start” on page 31. Quick Start Iteration 1 Model The PingPong_Iteration1 model is the completed version of the model developed in Connexis Quick start tutorial (Iteration 1). See “Quick Start” on page 31 for details. This model implements a simple ping pong application using Rose RealTime. This model is used as a starting point for PingPong_Iteration2 to show the simple steps required to quickly Connexis-enable an application built using Rose RealTime. To run the model, compile the PingPongApp component instance corresponding to your host compiler, and choose run from the item menu of the component instance under the PingPongProcessor. Quick Start Iteration 2 Model The PingPong_Iteration2 model is the completed version of the model developed in Connexis Quick start tutorial (Iteration 2). See “Quick Start” on page 31 for details. This model implements a simple distributed ping pong application using Rose RealTime and Connexis. It is a Connexis-enabled version of the model developed in Iteration 1, and demonstrates the simplicity of distribution using Connexis. 22 User Guide - Rational Rose RealTime Connexis The HelloWorld Model To run the model, please compile the Ping and Pong component instances corresponding to your host compiler, and choose run from the item menu of the component instances under the PingPongProcessor. The HelloWorld Model The HelloWorld model implements a simple distributed model using Connexis. The model demonstrates the use of the Connexis Locator Service and how it can be used to easily provide backup service in a distributed environment. The model contains two servers, a client, and the Connexis locator service, each running independently. The servers speak different languages (either English, or French). Initially, the client is bound to the server that comes up first. Once bound, the client makes requests to the server and the server sends back a greeting in the language it speaks. If the server to which the client is bound becomes unavailable, the client is notified of the connection loss, and it rebinds to the backup server, which starts responding to the client requests in the language it speaks. For example, if the client is initially bound to the English server, it will start receiving greetings in English. If you then terminate the English server (for example, resetting through the RTS panel), the connection will be lost momentarily, the client will be rebound to the French server, and the client will start receiving the greetings in French. Note: The greetings are output to the DOS window (Windows) and the RTS Output window (Solaris), which comes up when the client is started. Running the HelloWorld Model The model can be run on all supported host platforms. To run the application, start up the matching (for example, VC++6.0) set of locator, client, EnglishServer and FrenchServer component instances. ■ Keep the DOS (Windows) or RTS Output (Solaris) window for the client in view. The other DOS or RTS Output windows can be minimized to reduce screen clutter. ■ Run all the component instances from the corresponding RTS panels. User Guide - Rational Rose RealTime Connexis 23 Chapter 2 Using Connexis Model Examples ■ If you run the EnglishServer first, you should see “Hello World!!!” appear on the client DOS window repeatedly. At this point, you can terminate the EnglishServer instance by means of the RTS panel. The client will receive a connection loss, and will then switch over to the FrenchServer as soon it is rebound via the locator service. You should now start to see "Salut le monde!!!" displayed in the client DOS window. Additional HelloWorld Models The following models are extensions of the HelloWorld model. They provide examples of distributed load-sharing and fault-tolerant patterns. HelloWorldHotStandby A client connects to two servers through a proxy actor, and continually sends greeting requests. The proxy forwards the message to both servers, and both of the servers respond back to the proxy, which in turn relays the message from the active server to the client. If there is no response from the active server within a specified time period, the other server becomes active, and starts to handle all the client requests. HelloWorldLoadSharing This model consists of two servers (an English and a French one) that supply greeting messages for multiple clients. The clients connect to the servers in a round-robin fashion. For example, if you had four clients, the first and the third client would connect to one server and the second and the fourth client would connect to the other server. HelloWorldOverflowToBackupService This model contains two servers (an English and a French one). One of the servers is given a higher rank so that it acts as the primary server. The clients connect to the primary server until the primary server has reached its full capacity. Any subsequent clients will connect to the backup server, which will handle their greeting requests for those clients. 24 User Guide - Rational Rose RealTime Connexis The DCS Performance Model HelloWorldRedundantLocator The model consists of one server, multiple clients, and a primary and a backup locator. The clients connect to the server using the primary locator. The server, in turn, provides greeting signals for the clients. If the primary locator is shut down, all subsequent client-server connections will be established using the backup locator. The DCS Performance Model With the DCS Performance Model, you collect performance data for intra-thread, inter-tread, and inter-processor messaging throughput. Using this data, you can evaluate message throughput and transport latency within your environment. The performance model contains a client capsule and a server capsule that echo messages between each other. This lets you evaluate the amount of time required to send messages between capsules. The model measures performance between capsules in the following scenarios: ■ Client and server on the same thread ■ Client and server on different threads ■ Client and server in different processes (using the DCS) The model also provides data that can be used to measure the message latency using raw socket-based inter-process communication (IPC). Running the Performance Model Before compiling the components for the performance model, you must set the target configuration properties for the components. Once the components are built, the run-time operations must be configured to run either the CDM/UDP and CRM/TCP tests. To run the performance model 1. Set the C++ Compilation Target Services Library properly for the following components so that they can compile in your environment: ❑ ThroughputClient ❑ ThroughputServer User Guide - Rational Rose RealTime Connexis 25 Chapter 2 Using Connexis Model Examples All intra-thread, inter-thread, and inter-process tests run within the ThroughputClientInstance. The ThroughputServerInstance is used for the IPC tests and the benchmark UDP/TCP tests. 2. Edit the properties of the “inclusion paths” to include the TargetRTS target specific header files. For example, if you are running on a VxWorks target, the following inclusion path must be specified: $RoseRT_Home/C++/TargetRTS/src/target/TORNADO1 Note: These directories are not normally included in user models. They have been used in this model to facilitate portability to different target environments. 3. Set the run-time options for the client’s component instance according to the following chart: Table 2 Run-time options for the client component Option Description -s: specifies the endpoint of the server and is used in the client's registration string. (ex.: -s192.139.252.84:9900). This parameter must correspond to the server endpoint specified using -CNXep. -n specifies the number of messages to be echoed between the client and server for each test. -crm | -cdm specifies which transport is to be tested. -l specifies the local port to be used for the raw TCP/UDP benchmarks. -r specifies the remote port to be used for the raw TCP/UDP benchmarks. The remote address is obtained from the endpoint parameter (-s). 4. Set the run-time options for the server’s component instance according to the following chart: 26 User Guide - Rational Rose RealTime Connexis The DCS Performance Model Table 3 Option Description -crm | -cdm specifies which transport is to be tested. -l specifies the local port to be used for the raw TCP/UDP benchmarks. -CNXep = port -CNXep = CRM:port specifies the endpoint where the server is listening. -r specifies the remote port to be used for the raw UDP benchmarks. -a specifies the remote address to be used for the raw UDP benchmarks. 5. Run CDM/UDP and CRM/TCP. Performance model server output Rational Rose RealTime C++ Target Run Time System Release 6.30.B.01 (+c) Copyright (c) 1993-2000 Rational Software rosert: observability listening at tcp port 30503 ******************************************************************* * Please note: STDIN is turned off. * * To use the command line, telnet to the above mentioned port. * * The _output_ of any command will be displayed in _this_ window. * ******************************************************************* Rational Software Corp. Connexis(tm) - Distributed Connection Service (dcs) Release 6.30.B.154 Copyright (c) 1999-2000 Rational Software Corporation dcs: dcs: dcs: dcs: CDM Transport : enabled CDM listening at [cdm://192.139.252.171:9900] locator service not available metric service available DCS Performance Test Begins =========================== Client address for benchmark tests: 192.139.252.171 Benchmark tests listening at port: 9800 Benchmark tests connecting to remote port: 8800 User Guide - Rational Rose RealTime Connexis 27 Chapter 2 Using Connexis Model Examples Performance model client output Rational Rose RealTime C++ Target Run Time System Release 6.30.B.01 (+c) Copyright (c) 1993-2000 Rational Software rosert: observability listening at tcp port 30346 ******************************************************************* * Please note: STDIN is turned off. * * To use the command line, telnet to the above mentioned port. * * The _output_ of any command will be displayed in _this_ window. * ******************************************************************* DCS Performance Test Begins =========================== Number of messages per iteration: 10000 Server address for IPC tests: 192.139.252.171:9900 Benchmark tests listening at port: 8800 Benchmark tests connecting to remote port: 9800 Transport protocol to be tested: cdm Intra-thread Througput Test --------------------------Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682532:620000000 984682532:700000000 16 10000 80 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682532:700000000 984682532:780000000 64 10000 80 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682532:780000000 984682532:861000000 256 10000 81 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682533:261000000 984682533:351000000 1024 10000 90 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682533:351000000 984682533:501000000 4096 10000 150 Inter-thread Througput Test --------------------------- 28 User Guide - Rational Rose RealTime Connexis The DCS Performance Model Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682533:501000000 984682533:682000000 16 10000 181 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682533:912000000 984682534:112000000 64 10000 200 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682534:112000000 984682534:303000000 256 10000 191 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682534:513000000 984682534:683000000 1024 10000 170 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682534:693000000 984682534:914000000 4096 10000 221 Rational Software Corp. Connexis(tm) - Distributed Connection Service (dcs) Release 6.30.B.154 Copyright (c) 1999-2000 Rational Software Corporation dcs: dcs: dcs: dcs: CDM Transport : enabled CDM listening at [cdm://192.139.252.171:2202] locator service not available metric service available Inter-processor Througput Test -----------------------------Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682535:134000000 984682536:95000000 16 10000 961 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682536:105000000 984682537:47000000 64 10000 942 User Guide - Rational Rose RealTime Connexis 29 Chapter 2 Using Connexis Model Examples Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682537:57000000 984682538:68000000 256 10000 1011 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682538:78000000 984682539:290000000 1024 10000 1212 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682539:290000000 984682541:152000000 4096 10000 1862 Inter-process Benchmark Test ---------------------------Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682541:173000000 984682541:513000000 16 10000 340 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682541:523000000 984682541:823000000 64 10000 300 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682541:833000000 984682542:144000000 256 10000 311 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682542:144000000 984682542:524000000 1024 10000 380 Start time [s:ns]: Finish time [s:ns]: Message size: Messages sent: Duration [in ms]: 984682542:534000000 984682543:406000000 4096 10000 872 TESTS COMPLETE!!!! 30 User Guide - Rational Rose RealTime Connexis Chapter 3 Quick Start Connexis is a connection tool that provides robust, transparent communication between Rational Rose RealTime executable models. Rational Connexis is integrated with Rational Rose RealTime, which is a modeling tool that generates executables from UML models. Connexis improves an application’s time to market by eliminating the need to design, develop, and test a custom Inter-Process Communications (IPC) mechanism. The use of a production quality, Commercial Off The Shelf (COTS) distribution component, such as Connexis, simplifies and de-risks the design and deployment of distributed systems. The Connexis Quick start presented in this chapter takes you through the general steps that are required to create and execute a Connexisenabled application. To follow the steps laid out in this chapter, you should have: ■ Rational Rose RealTime installed on your workstation ■ Rational Connexis installed on your workstation ■ a general understanding of Rational Rose RealTime and UML Quick Start Overview The application to be created is a simple “ping pong” application. The clients send a ping message to the server, and the server responds with a pong message. Registration is accomplished using the Locator Service. The necessary command line options for starting the applications are also presented. User Guide - Rational Rose RealTime Connexis 31 Chapter 3 Quick Start This application is created in three iterations: ■ Iteration 1: Creating the Rose RealTime Model - creates the basic architecture using wired ports to connect the Ping and Pong capsules. This also involves a third capsule which acts as the container for the Ping and Pong capsules. ■ Iteration 2: Connexis Enabling our Application- makes modifications so that Ping and Pong communicate through unwired ports that make use of Connexis connections. Iteration 1 focuses on creating a simple Rose RealTime model; therefore, readers who are familiar with Rose RealTime can start with the solution for Iteration 1, which is found in the examples directory, $ROSERT_HOME\CONNEXIS\C++\examples. Iteration 2 focuses on Connexis-enabling the Rose RealTime model. Note: The package organization of the example models differs slightly from this tutorial because the examples support multiple platforms; however, the model elements are the same. Many of the steps that are presented in these iterations are examples of good modeling practices. Explanations and the rationale behind these good modeling practices are presented where appropriate and are separated from the rest of the text by the heading “Rationale for ....” 32 User Guide - Rational Rose RealTime Connexis Quick Start Overview Figure 6 presents the final architecture of the model that is created in Iteration 2. Figure 6 Ping pong application architecture (at the end of Iteration 2) Even though the ping pong application is very simple it is still appropriate to present a sequence diagram that documents its behavior. The sequence diagram, shown in Figure 7, describes the messages that are sent between the Ping and Pong capsules. The events illustrated in this sequence diagram are discussed throughout the remainder of the Quick start. User Guide - Rational Rose RealTime Connexis 33 Chapter 3 Quick Start Figure 7 34 Ping Pong application sequence diagram User Guide - Rational Rose RealTime Connexis Iteration 1: Creating the Rose RealTime Model Iteration 1: Creating the Rose RealTime Model Iteration 1 focuses on creating the Rose RealTime model that is used throughout the Quick start. Step 1: Create a New Model To create a new model in Rose RealTime: 1. Select File > New. Step 2: Create Packages for the Model To create the ping pong client package: 1. Open the pop-up menu on the Logical View package in your Rose RealTime browser. Do this by right-clicking on the Logical View package as shown in Figure 8. Figure 8 Creating packages 2. Select New > Package from the pop-up menu. User Guide - Rational Rose RealTime Connexis 35 Chapter 3 Quick Start 3. While the default package name is selected, type in “PingPongClient” to set the name of the new package. To create the ping pong server package: Follow the same steps as those listed for “To create the ping pong client package:” except name the new package “PingPongServer.” To create the ping pong container package: Follow the same steps as those listed for “To create the ping pong client package:” except name the new package “Container.” To create the ping pong utility package: Follow the same steps as those listed for “To create the ping pong client package:”- except name the new package “Common.” You should now have all of the packages that are required, as shown in Figure 9. 36 User Guide - Rational Rose RealTime Connexis Iteration 1: Creating the Rose RealTime Model Figure 9 Created packages Rationale for creating packages It is good practice (although not required) to organize all of your Rose RealTime models into packages. You might think that it is overkill for a model that is as trivial as this one, but it is good to get in the habit of doing this, remember small models usually become big models eventually and it is easier to start off with packages than it is to add them later. The main reasons for wanting to organize your models into packages are: ■ ease of understanding and navigation - Packages give you an extra level of abstraction above what is provided by the classes and capsules in your model. ■ separation of concerns - It is a good way of dividing the work that is to be done between teams or individuals on teams. User Guide - Rational Rose RealTime Connexis 37 Chapter 3 Quick Start ■ configuration management - Packages are a possible unit of version control. ■ access control - You can define the visibility of classes and capsules within packages. This makes it possible to control the access to design elements that are organized into packages. There are many other reasons for wanting to organize your models into packages. For more information on this topic, refer to the “Rose RealTime User’s Guide.” Step 3: Create the Ping, Pong, and ContainerCapsules In this application, the Ping capsule fulfills the role of a client. It is referred to as the client because it only manages a single connection. The server side of the application is responsible for managing multiple connections (one for each client it is connected to). The Pong capsule fulfills the role of the server in this application. The container capsule contains both the Ping and Pong capsules in Iteration 1 of the application. Remember that the application is being built in two iterations; the first uses wired ports and the second uses Connexis-enabled, non-wired ports. 38 User Guide - Rational Rose RealTime Connexis Iteration 1: Creating the Rose RealTime Model To create the Ping capsule: 1. Select the PingPongClient package as shown in Figure 10. Figure 10 Creating a new capsule 2. Open the pop-up menu and select New > Capsule. 3. While the default name of the new capsule is still highlighted, type in “Ping." This renames the new capsule. To create the Pong capsule: To create the Pong capsule, follow the same steps as those listed for “To create the Ping capsule:” except create the Pong capsule in the PingPongServer package. To create the Container capsule: To create the Container capsule, follow the same steps as those listed for “To create the Ping capsule:” except create the Container capsule in the Container package. User Guide - Rational Rose RealTime Connexis 39 Chapter 3 Quick Start The connection topology that is used in this application is an oversimplification of a real-world distributed application. In real-world distributed applications, objects would typically take on the role of client in some communication scenarios and the role of server in others. Common connection topologies for distributed applications are discussed in “Establishing Connections” on page 107. You should now have all of the capsules that are required as shown in Figure 11. Figure 11 Created capsules Step 4: Create the PingPong Protocol Class In Rose RealTime, capsules communicate with one another through ports. Ports are defined by a protocol. A protocol is a definition of a set of incoming signals, along with their associated data types, and a set of outgoing signals, along with their associated data types. To create a protocol class: 1. Open the pop-up menu on the Common package by right-clicking on the Common Package as shown in Figure 12. 2. Select New > Protocol from the pop-up menu. 40 User Guide - Rational Rose RealTime Connexis Iteration 1: Creating the Rose RealTime Model 3. While the default name of the new protocol is still highlighted, type in “PingPong." This renames the new protocol. Figure 12 Creating protocol classes The PingPong protocol consists of an In Signal called pong, and an Out Signal called ping. Neither of these signals have data associated with them. To add the signals to the protocol class: 1. Open the pop-up menu on the PingPong protocol class. 2. Select Open Specification from the pop-up menu. 3. Select the Signals tab. 4. Open the pop-up menu on the In Signals panel (by right clicking on the white space below In Signals as shown in Figure 13) and select Insert. A new signal is added and its default name is highlighted. User Guide - Rational Rose RealTime Connexis 41 Chapter 3 Quick Start Figure 13 Protocol specification window 5. While the default name is highlighted, type in “pong." This names the In Signal pong. 6. Repeat steps 4 and 5 in the Out Signal panel. Name the Out Signal “ping." 7. Click the OK button. Rationale for choice of conjugation and signal names The In Signal is named pong because the protocol is defined from the perspective of the client. Remember that the client side of the application is implemented by the Ping capsule. The Ping capsule sends ping signals and receives pong signals; therefore, the protocol that is being used should have a pong In Signal and a ping Out Signal. 42 User Guide - Rational Rose RealTime Connexis Iteration 1: Creating the Rose RealTime Model The practice of conjugating the server side of a connection is not required but it is a good way of keeping the naming of ports and protocols consistent. Conjugating the server side of a connection has the added benefit of reducing modeling efforts. Ports by default are not conjugated and there are usually more client ports that server ports. Step 5: Build the Structure of the Model As was outlined in the introduction section of this chapter, the first iteration uses wired ports to connect the Ping and Pong capsules. This means that a capsule that acts as the container for the Ping and Pong capsules must be created. This is the capsule that was called Container. To create Ping and Pong capsule roles in the Container capsule: 1. Create a new class diagram called “Architecture." This is done by right-clicking on the Logical View package and selecting New > Class Diagram from the pop-up menu. 2. Double-click Architecture to open the class diagram. 3. Drag one of each of the Ping, Pong, and Container capsule, from the browser onto the diagram. 4. Select the Unidirectional Aggregation tool . 5. Create an aggregation relationship between the Container capsule and the Ping capsule. Do this by clicking and dragging from the Container capsule to the Ping capsule as shown in Figure 14. User Guide - Rational Rose RealTime Connexis 43 Chapter 3 Quick Start Figure 14 Creating aggregations between capsules 6. Repeat step 5 to create an aggregation relationship between the Container capsule and the Pong capsule. 7. Select the Container/Ping aggregation and open its specification. Type in the name “ping." 8. Assign a cardinality of 5 to the Container/Ping aggregation. In a “real” application, the cardinality would be specified using a constant as opposed to a literal. A literal was used in this example only for brevity. 9. Click the OK button. 10. Select the Container/Pong aggregation and open its specification. Type the name “pong." 11. Click the OK button. 44 User Guide - Rational Rose RealTime Connexis Iteration 1: Creating the Rose RealTime Model If you now open the structure diagram of the Container capsule, you should see a structure similar to what is shown in Figure 15. Figure 15 Container capsule’s structure diagram Note: This containment structure could have been created just as easily from the structure editor of the Container capsule. To create required ports on Ping and Pong capsules: 1. Drag the PingPong protocol class onto the Architecture class diagram. 2. Create an aggregation association between the Ping capsule and the PingPong protocol as shown in Figure 16. Name the association “pingPong.” User Guide - Rational Rose RealTime Connexis 45 Chapter 3 Quick Start Figure 16 Creating ports from a class diagram 3. Create an aggregation association between the Pong capsule and the PingPong protocol. Name the association “pingPong." 4. Open the specification for the aggregation between the Pong capsule and the PingPong protocol. 5. Specify a cardinality of 5 and click the Conjugated check box. 6. Click the OK button. To create a log protocol: 1. Select the Ping capsule. 2. Open its structure diagram. 3. Drag a log protocol onto the structure diagram. Do this by selecting the log protocol found in the RTClasses package in the Logical View package. 4. Select the log icon and open its specification. 5. Type in the name “log” and ensure that Protected is enabled. 6. Click the OK button. 46 User Guide - Rational Rose RealTime Connexis Iteration 1: Creating the Rose RealTime Model Rationale for visibility of ports The log protocol is used to access the logging service that is built into the Rose RealTime libraries. The logging service is used primarily for printing messages to standard error during the initial debugging of models. The PingPong port is shown in the class diagram because it is architecturally significant. The log port is shown in the structure diagram because it is an implementation detail; however, the log port could have been added to the class diagram, if desired, and the behavior would be exactly the same. Repeat steps 1 to 6 for the Pong capsule. To connect the Ping and Pong capsules: 1. Open the structure editor for the Container capsule by rightclicking and choosing Open Structure Diagram. 2. Select the Connector tool . 3. Connect the pingPong port on the Ping capsule to the pingPong port on the Pong capsule as shown in Figure 17. Figure 17 Creating connectors between ports The structure for Iteration 1 is now complete. Your class diagram should look the same as the one shown in Figure 18. Note: To show the port and log icons, select the capsule and choose Options > Show Visibility. User Guide - Rational Rose RealTime Connexis 47 Chapter 3 Quick Start Figure 18 Completed structure for Iteration 1 Step 6: Implement the State Machines for Ping and Pong To implement the state machines for the Ping and Pong capsules perform the steps listed below. To create Ping’s state machine: 1. Select the Ping capsule. 2. Open the state editor by right-clicking and choosing Open State Diagram. 3. Select the state tool and drop a state on the diagram. Do this by clicking the state tool and clicking anywhere on the diagram. 4. Name this state “ready." 5. Select the transition tool and draw the initial transition from the initial state to the ready state. 48 User Guide - Rational Rose RealTime Connexis Iteration 1: Creating the Rose RealTime Model 6. Double-click the transition, and select the Actions tab in the specification editor. 7. Type in the following code, and then click the OK button (see Figure 19). pingPong.ping().send(); Figure 19 Adding code to a transition 8. Select the self transition tool and draw a self transition on the ready state, name this transition “pong." Your diagram should look similar to Figure 20. User Guide - Rational Rose RealTime Connexis 49 Chapter 3 Quick Start Figure 20 Creating states 9. Double-click on the pong transition and select the Actions tab. 10. Type in the following code: log.log("received a pong"); pingPong.ping().send(); Note: In a real world application, you would not immediately send a Ping request. You would most likely perform additional processing where another event would trigger the sending of another Ping request. 11. Click the Apply button. 12. Select the Triggers tab. 13. Right-click in the control area and select Insert from the pop-up menu as shown in Figure 21. 50 User Guide - Rational Rose RealTime Connexis Iteration 1: Creating the Rose RealTime Model Figure 21 Adding triggers to a transition 14. Select the pingPong port and the pong signal from the resulting Event Editor dialog as shown in Figure 22 and click the OK button. User Guide - Rational Rose RealTime Connexis 51 Chapter 3 Quick Start Figure 22 Selecting the port and signal To create Pong’s state machine: 1. Open the state editor for the Pong capsule. 2. Select the state tool and drop a state on the diagram. 3. Name this state “ready." 4. Select the transition tool and draw the initial transition from the initial state to the ready state. 5. Select the self transition tool and draw a self transition on the ready state, name this transition “ping." 6. Double-click on the ping transition, and select the Actions tab in the specification editor. 7. Type in the following code: log.log("received a ping"); rtport->pong().reply(); 8. Click the Apply button. 9. Select the Triggers tab. 52 User Guide - Rational Rose RealTime Connexis Iteration 1: Creating the Rose RealTime Model 10. Right-click in the control area and select Insert from the pop-up menu. 11. Select the pingPong port and the ping signal from the resulting Event Editor dialog and click the OK button. Step 7: Build and Test the Model To build and run a model from Rose RealTime, you must first create a component. Components are used to model the physical elements that may reside on a node, such as executables, libraries, source files, and documents. In other words, the component represents the physical packaging of the logical elements, such as classes and capsules. For the purposes of this example, the components that are created are going to represent executables. Components have an associated top-level capsule. The top-level capsule defines what parts of the model are contained in the executable. In this case, the Container capsule should be made the top-level capsule of the new component. To create a component: 1. Choose Build > Component Wizard to run the Build Component Wizard. 2. Click Next. 3. Type “PingPongApp” in the component name field as shown in Figure 23. Ensure that the package is Component View and click Next. User Guide - Rational Rose RealTime Connexis 53 Chapter 3 Quick Start Figure 23 Setting the component identity - Iteration 1 4. Select C++ and click Next. 5. Click the OK button. To customize the component: 1. Click Next. 2. Click Set the top-level capsule as shown in Figure 24. 54 User Guide - Rational Rose RealTime Connexis Iteration 1: Creating the Rose RealTime Model Figure 24 Setting the top-level capsule - Iteration 1 3. Select the package. In this case, select Container from the dropdown list. 4. Select the capsule. In this case, select the Container capsule from the drop-down list 5. Click Next. 6. Click Next. 7. Choose the target configuration as in Figure 25. If your development configuration is Visual C++ 6.0 in Windows NT, select NT40T.x86-VisualC++-6.0 and click Next. If your configuration is different, select the appropriate target. User Guide - Rational Rose RealTime Connexis 55 Chapter 3 Quick Start Figure 25 Setting the target service library 8. Click Finish and click the OK button. There are many options that are associated with components. For the purposes of this example the default values are sufficient. To create a processor: To execute the model from within the toolset, you must assign the component that was created in the last step to a processor. This tells Rose RealTime to execute the component on a specific machine on your network. There are many options that can be set for the processor and for executing a component instance on the processor. The defaults are sufficient in this case. To create a processor: 1. Right-click on the Deployment View folder in the Rose RealTime browser and select New > Processor from the pop-up menu. 2. Name this processor “PingPongProcessor." 3. Drag and drop the PingPongApp component onto the PingPongProcessor. 56 User Guide - Rational Rose RealTime Connexis Iteration 1: Creating the Rose RealTime Model You now should have a PingPongProcessor that contains a PingPongApp component instance as shown in Figure 26. Figure 26 Processor and component instance To build the model: 1. Save the model as "Tutorial_Iteration1." 2. Select the PingPongApp component. 3. Open the pop-up menu and choose Build > Quick Build. 4. Click Add References and Continue. 5. Click the OK button. Rationale for using Quick Build In this rapid prototyping example, we allow the tool to inform us about missing references and add them. In a large, managed application, references should be carefully managed and added manually to the component. Run the PingPong component instance To run the PingPong application: 1. Right-click on the PingPongAppInstance and select Run from the pop-up menu. This creates the run-time environment within Rose RealTime. 2. Select No to “Build the component?” since it is already built. User Guide - Rational Rose RealTime Connexis 57 Chapter 3 Quick Start The top left hand corner of the Rose RealTime application should now look something like what is illustrated in Figure 27. A console window also appears. This window is where the standard output from the model is displayed. Keep this window visible so that you can see the output that is being displayed. Figure 27 Rose RealTime run-time environment 3. Press the Start button to execute the model. While the PingPongApp is running, you should see messages being printed to the console window. The Pong capsule receives ping signals from the Ping capsule and prints “received a ping” each time it does. Likewise, the Ping capsule receives pong messages from the Pong capsule and prints “received a pong” each time it does. 58 User Guide - Rational Rose RealTime Connexis Iteration 2: Connexis Enabling our Application Because of the way that this model has been designed and the way the Target RSL message queuing works, this model prints five “received a ping” messages followed by five “received a pong” messages and continues doing this until the model is stopped. All messages that are sent to a capsule are queued in a priority queue. In this model, all five of the “ping” messages are queued before a “pong” response is generated. This causes the messages to be output as shown in the console window. 4. Click the Shutdown button process. in the Runtime Viewer to stop the Iteration 2: Connexis Enabling our Application Connexis manages connections that are established between unwired ports. Unwired ports are ports whose connections are defined at runtime. Unlike wired ports, unwired ports cannot have connectors defined between themselves and other ports. The connections established between unwired ports can also be removed and reestablished at run-time. Since unwired ports are used in Iteration 2, the first thing to do for Iteration 2 is to remove the wired connections that were created in Iteration 1 and make the wired pingPong ports unwired. Step 1: Remove the Connector Between the pingPong Ports To remove the connector between the pingPong ports: 1. Open the model “Tutorial_Iteration1” that you created in Iteration 1. 2. Save the model as “Tutorial_Iteration2.” 3. Open the Container capsule’s structure diagram as shown in Figure 28. 4. Select the connector that is joining the pingPong ports on the Ping and Pong capsules. Right-click and choose Remove/Exclude to delete the connector. User Guide - Rational Rose RealTime Connexis 59 Chapter 3 Quick Start Figure 28 Removing the connector between ping and pong Step 2: Make Changes to Pong’s pingPong Port To make changes to Pong’s pingPong port: 1. Open the Pong capsule’s structure diagram. 2. Select the pingPong port and open its specification. 3. Uncheck the Wired option as shown in Figure 29. 4. Check the Publish option. This makes the port externally visible. 5. Since the port is being registered in transition code, the Application radio button must also be checked. 60 User Guide - Rational Rose RealTime Connexis Iteration 2: Connexis Enabling our Application Figure 29 Changing port specifications for Pong Step 3: Make Changes to Ping’s pingPong Port To make changes to Ping’t pingPong port: 1. Open the Ping capsule’s structure diagram. 2. Select the pingPong port and open its specification. 3. Uncheck the Wired option as shown in Figure 30. 4. Check the Notification check box. 5. Since the port is being registered in transition code, the Application radio button must also be checked. User Guide - Rational Rose RealTime Connexis 61 Chapter 3 Quick Start Figure 30 Changing port specifications for Ping The Notification box has been checked so the Ping capsule will be notified when a connection has been established on the pingPong port. The Notification box was not checked in the Pong capsule because it doesn’t really care when connections have been established to its port. This is because the Pong capsule has published its interface and is just waiting for others to connect to it. In a more realistic design, the Pong capsule may be required to keep track of how many clients are connected at any given time. This would make Pong’s state machine slightly more complicated. In the Ping capsule, the notification event will be used. Ping’s state machine must be changed so that it waits for an rtBound signal to be received on the pingPong port before sending a Ping message. Note: The Target RSL sends the rtBound signal as notification that a connection was established. 62 User Guide - Rational Rose RealTime Connexis Iteration 2: Connexis Enabling our Application Step 4: Adding DCS Layer Notification to the Ping and Pong Capsules To add DCS layer notigication to Ping and Pong capasules: 1. Open the Class Diagram called Architecture you created in the first iteration. 2. Drag the RTDInitStatus protocol, located in the RTDInterface package in the Logical View, onto the diagram. 3. Select the Unidirectional Aggregation tool. 4. Create an aggregation association between the Pong capsule and the RTDInitStatus protocol. Name the association "dcsStatus." 5. Open the specification for the aggregation between the Pong capsule and the RTDInitStatus protocol. 6. Specify that it is: a. protected b. an end port c. not wired, and d. notification enabled 7. Specify that the Registration will be handled automatically, and specify a registration override of “:RTDInitStatus.” 8. Repeat steps 3 through 7 for the Ping capsule. Before a model attempts to publish or subscribe to services through Connexis, it should verify that the DCS layer is active and properly initialized. If not, publication and subscription attempts will fail. The Connexis capsule will publish the RTDInitStatus service through the Internal Layer Service when it has completed its initialization. By subscribing to the service and enabling notification, the model can wait until it receives notification from Connexis before registering its SAPs or SPPs. User Guide - Rational Rose RealTime Connexis 63 Chapter 3 Quick Start Figure 31 Port Specification for dcsStatus Step 5: Modify Ping’s State Machine to Wait for Connexis To modify Ping’s state machine to wait for Connexis: 1. Open the state diagram for Ping. 2. Add a new state to the diagram and call it “waitingForDCS.” 3. Delete the Initial transition to the “ready” state. 4. Add a new Initial transition to the “waitingForDCS” state. 5. Add a transition from the “waitingForDCS” state to the “ready” state. Label this transition “dcsReady.” 6. Open the specification for the “dcsReady” transition and click the Triggers tab. 7. Insert a trigger for the rtBound event on the dcsStatus port. We will add the action code to subscribe to the service in a later step. 64 User Guide - Rational Rose RealTime Connexis Iteration 2: Connexis Enabling our Application Figure 32 Add a transition for dcsStatus Step 6: Modify Pong’s State Machine to Wait for Connexis To modify Pong’s state machine to wait for Connexis: 1. Open the state diagram for Pong. 2. Add a new state to the diagram and call it “waitingForDCS.” 3. Delete the Initial transition to the “ready” state. 4. Add a new Initial transition to the “waitingForDCS” state. 5. Add a transition from the “waitingForDCS” state to the “ready” state. Label this transition “dcsReady.” 6. Open the specification for the “dcsReady” transition and click the Triggers tab. 7. Insert a trigger for the rtBound event on the dcsStatus port. We will add the action code to publish the service in a later step. User Guide - Rational Rose RealTime Connexis 65 Chapter 3 Quick Start Step 7: Modify Ping’s State Machine to Wait for Notify To modify Ping’s state machine to wait for notify: 1. Open the state diagram for Ping. 2. Add a new state to the diagram and call it “connected." 3. Add a transition between the “ready” state and the “connected” state. Label this transition “bound." 4. Open the specification for the “bound” transition and click on the Triggers tab. 5. Insert a trigger for the rtBound event on the pingPong port. Figure 33 Transition Specification for rtBound 6. Click on the Actions tab and add the following code in the code editor: pingPong.ping().send(); 7. Move the pong transition from the ready state to the connected state. To do this, select the transition and drag both ends of the transition over onto the Connected state one at a time. Your final state diagram should be similar to the one shown in Figure 34. 66 User Guide - Rational Rose RealTime Connexis Iteration 2: Connexis Enabling our Application Figure 34 Ping’s state diagram Step 8: Add Registration Code to the Ping and Pong Capsules Connexis needs to know how to connect the unwired ports in your model. A client can “lookup” a server in one of three places: ■ locally - connect only with current TargetRTS ■ explicit address - connect only to the TargetRTS at the specified address ■ locator - connect using the Locator service In addition to these options, there are also several parameters that can be passed to Connexis when you register a port. These parameters are discussed in detail in “Establishing Connections” on page 107. In this example, the Ping and Pong capsules are going to register with the Locator service. The basic syntax for registering a port with the Locator service is: // for the client side of the connection registerSAP(“registrationString”); and //for the server side of the connection registerSPP(“registrationString”); User Guide - Rational Rose RealTime Connexis 67 Chapter 3 Quick Start The registration string is different depending on which of the three lookup types you are using (local, explicit address, locator). In this example, the Locator service is being used, so the form of the registration string is: connection_service:/registration_name The only connection service currently available is the Distributed Connection Service (DCS) and Connexis Reliable Messaging (CRM). This leaves us with the following syntax for registering the pingPong port in the client: registerSAP(“dcs:/pingpong”); and the syntax for registering the pingPong port in the server as: registerSPP(“dcs:/pingpong”); In this example, the “pingpong” portion of the registration string could have been any string. This is the simplest case of registration using the Locator. There are many parameters that can be supplied to the Locator as part of the registration string for doing things like setting the transport protocol that is being used. These parameters are discussed in “Establishing Connections” on page 107. To add registration code to the Ping capsule: 1. Open the state diagram for the Ping capsule. 2. Double-click on the dcsReady transition and select the Actions tab in the resulting dialog. 3. Delete the existing text and enter the following code into the code window: if (!pingPong.registerSAP(“dcs:/pingpong”)) { log.log(“Ping registration failed”); } 4. Click the OK button. To add registration code to the Pong capsule: 1. Open the state diagram for the Pong capsule. 2. Double-click on the dcsReady transition and select the Actions tab in the resulting dialog. 68 User Guide - Rational Rose RealTime Connexis Iteration 2: Connexis Enabling our Application 3. Enter the following code into the code window: if (!pingPong.registerSPP(“dcs:/pingpong”)) { log.log(“Pong registration failed”); } 4. Click the OK button. Now all of the model changes that are required have been completed. The next step is to set up the Connexis environment and create two new components. One of the components represents the Ping application and the other the Pong application. Step 9: Add the Connexis Configuration Capsules to Your Model The Ping Pong Model requires the Ping and the Pong capsule to include the DCS capsule roles. We will use the Connexis configuration interface to add an RTDBase_Agent to Ping and an RTDBase_Locator_Agent to Pong. (This configuration can also be done manually). User Guide - Rational Rose RealTime Connexis 69 Chapter 3 Quick Start To configure the Ping Capsule: 1. Right-click the Ping capsule as in Figure 35. Figure 35 Configuring the Ping Capsule 2. Select Configure Capsule for Connexis. The Configure Connexis Dialog appears. 70 User Guide - Rational Rose RealTime Connexis Iteration 2: Connexis Enabling our Application Figure 36 Configure Connexis Capsule dialog 3. Select the following options: a. Include DCS capsule role into this capsule b. Target Agent (Viewer Debugging) 4. Click OK. A dialog, suggesting that “Connexis packages be shared into this model,” appears. Figure 37 5. Click Sharing Connexis Packages request dialog Yes. You can see that the DCS capsule role has been added by viewing the Ping capsule structure (see Figure 38, Ping Capsule Structure). User Guide - Rational Rose RealTime Connexis 71 Chapter 3 Quick Start Figure 38 Ping Capsule Structure To configure the Pong Capsule: 1. Right-click the Pong capsule. 2. Select 72 Configure Capsule for Connexis. User Guide - Rational Rose RealTime Connexis Iteration 2: Connexis Enabling our Application The Configure Connexis dialog appears. Figure 39 Configure Connexis Capsule 3. Select the following options: a. Include DCS Capsule Role into this capsule b. Target Agent (Viewer Debugging) c. Locator Functionality (Backup/Primary) 4. Click OK. You can see that the DCS capsule role has been added by viewing the Pong capsule structure. Since Pong also supports the locator, the class of the DCS role is RTDBase_Locator_Agent instead of RTDBase_Agent. Rationale for selecting RTD interfaces In this configuration, only the Pong (server) capsule can be the locator. We could use an RTD_Base_Locator_Agent reference in both Ping and Pong, in which case either capsule could serve as the primary locator. The locator’s location is determined by the parameters specified in “Step 13: Build and Execute the Models." User Guide - Rational Rose RealTime Connexis 73 Chapter 3 Quick Start For more information about the features provided by the different RTDInterface capsules, refer to “Adding Connexis Support to Your Model” on page 83. Step 10: Create and Configure the Ping Component Create a component for the Ping application. To create the Ping component: 1. Select the Component View package. 2. Open the pop-up menu and select New > Package. 3. Name the package “DistributedApp." 4. Choose Build > Component Wizard to run the Build Component Wizard. 5. Click Next. 6. Type “Ping” in the component name field as shown in Figure 40. Ensure that the package is DistributedApp and click Next. Figure 40 Setting the component identity - Iteration 2 7. Select C++ and click Next. 8. Click the OK button. 74 User Guide - Rational Rose RealTime Connexis Iteration 2: Connexis Enabling our Application To customize the component: 1. Click Next. 2. Click Set the top-level capsule as shown in Figure 41. a. Select PingPongClient package from the drop-down list. b. Select Ping as the capsule. Figure 41 Setting the top-level capsule - Iteration 2 3. Click Next. 4. Click Next. 5. Choose the target configuration. Use the same target configuration as in “To customize the component:” on page 54, step 7. Step 11: Create and Configure the Pong Component Create a component for the Pong application. To create the Pong component: 1. Choose Build > Component Wizard to run the Build Component Wizard. 2. Click Next. 3. Type “Pong” in the component name field. Ensure that the package is DistributedApp and click Next. User Guide - Rational Rose RealTime Connexis 75 Chapter 3 Quick Start 4. Select C++ and click Next. 5. Click the OK button. To customize the component: 1. Click Next. 2. Set the top level capsule: a. Select PingPongServer package from the drop-down list. b. Select Pong as the capsule. 3. Click Next. 4. Click Next. 5. Choose the target configuration. Use the same target configuration as in “To customize the component:” on page 54, step 7. 76 User Guide - Rational Rose RealTime Connexis Iteration 2: Connexis Enabling our Application Step 12: Add Component Dependencies You need to create dependencies between the Ping component and the Connexis DCS library, and the Pong component and the DCS library. To add component dependencies: 1. Right-click the Ping Component. Figure 42 2. Select Configuring the Ping Component Connexis > Configure Component. The Component Diagram Selection dialog appears. User Guide - Rational Rose RealTime Connexis 77 Chapter 3 Quick Start Figure 43 3. Select 4. Click Component Diagram Selection dialog Component View: Main. OK. You have created a dependency between the Ping component and the DCS library. 5. Repeat steps one to four for the Pong component. The Main diagram in Component View will appear as in Figure 44. You should now have Ping and Pong components that are ready to be compiled. 78 User Guide - Rational Rose RealTime Connexis Iteration 2: Connexis Enabling our Application Figure 44 Main component view diagram Step 13: Build and Execute the Models Now that the components have been created and configured, they must be built. This is done by right-clicking on the component and selecting Build from the pop-up menu. To create a Ping processor and component instance: 1. Create a processor for the Ping component and name it “PingProcessor." 2. Drag the Ping component onto the PingProcessor to create a component instance. 3. Select the PingInstance and open its specification. 4. Add the following code to the Parameters field in front of the code “-obslisten=30468”: -CNXep=cdm://localhost:7777 -CNXlpep=cdm://localhost:8888 Your final code should appear similar to the line below. Note that the target observability port number, 30468, will vary from this example. -CNXep=cdm://localhost:7777 -CNXlpep=cdm://localhost:8888 obslisten=30468 Note: See page 253 for information on using “localhost.” User Guide - Rational Rose RealTime Connexis 79 Chapter 3 Quick Start 5. Click the OK button. To create a Pong processor and component instance: 1. Create a processor for the Pong component and name it “PongProcessor." 2. Drag the Pong component onto the PongProcessor to create a component instance. 3. Select the PongInstance and open its specification. 4. Add the following code to the Parameters field in front of the code “-obslisten=30477”: -CNXep=cdm://localhost:8888 -CNXlp Your final code should appear similar to the line below. Note that the target observability port number, 30477, will vary from this example. -CNXep=cdm://localhost:8888 -CNXlp -obslisten=30477 5. Click the OK button. Rationale for the Connexis parameters The -CNXep= parameter identifies the cdm endpoint at which the component instance listens. The -CNXlp parameter on the PongInstance specifies that the PongInstance will act as the primary locator. The -CNXlpep= parameter informs the PingInstance of the location of the primary locator. Note that the -CNXep of the PongInstance is the value of the -CNXlpep of the PingInstance. For more information about Connexis parameters, refer to “Establishing Connections” on page 107. Run the Pong component instance To run the Pong component instance: 1. Right-click on the PongInstance and select Run from the pop-up menu. 2. Select No to “Build the component?” since it is already built. A console window appears. 3. Press the Start button to execute the model. 80 User Guide - Rational Rose RealTime Connexis Iteration 2: Connexis Enabling our Application Run the Ping component instance To run the Ping component instance: 1. Right-click on the PingInstance and select Run from the pop-up menu. 2. Select No to “Build the component?” since it is already built. A second console window appears for the Ping component instance. 3. Press the Start button to execute the model. Note: The ping and pong reports appear in separate console windows. The two processes are communicating through Connexis. Optional: Distribute the model When a model has been Connexis-enabled, it may be distributed by simply changing the executable parameters. The hostname "localhost" was used in previous component instance specifications. Since this has a different meaning on each host, it must be replaced with the actual hostname. For this example the machine "angus" will be used for Ping and "bruce" for Pong. 1. Start Rose RealTime running on angus and bruce. Build the Ping component on angus and the Pong component on bruce if you have not already done so. 2. On angus, open the PingInstance specification and change the CNXep and -CNXlpep parameters to be: -CNXep=cdm://angus:7777 -CNXlpep=cdm://bruce:8888 3. On bruce, open the PongInstance specification and change the CNXep parameter to be: -CNXep=cdm://bruce:8888 4. Run the PingInstance on angus and the PongInstance on bruce. Observe the same behavior that you saw in a single-processor environment. Note: To keep this exercise simple, Rose RealTime was run on each of the target processors. In a normal development situation you will run Rose RealTime on a single host from which all targets are observed and controlled. User Guide - Rational Rose RealTime Connexis 81 Chapter 3 Quick Start Optional: Complete the HelloWorld Tutorial Once you have completed the Quick Start, proceed to the HelloWorld tutorial, provided in the Rose RealTime online help. It provides information on using the Locator and shows you how to work with rtbound and rtunbound notifications. Basic Connexis Development Approach Summary This section outlines the basic steps to follow to distribute your model using Connexis. 1. Design your Rose RealTime application. Although it is very easy to repartition your model and distribute it in a different manner using Connexis, it is still a good idea to consider distribution when you are doing your up-front designs. The reason for this is performance. Many of the performance issues that you encounter in a distributed application are a direct result of not partitioning your model properly. Remember, intra-thread messages are faster than inter-thread messages, which are faster than interprocess messages, which are faster than inter-node messages. 2. Specify the registration strings and connection parameters on your unwired ports. If the nature of your application is such that you know the names of the endpoints that you want to communicate with (either through the use of an algorithmic mapping or by reading a configuration file), then explicit endpoint names can be used in the registration strings of the unwired ports in the model. For more information refer to “External explicit examples” on page 124. If this is not the case, you may want to make use of the Locator Service. In either case, each of the unwired ports in your model must be registered with an appropriate registration string. Once this has been completed and the connections are being initialized properly, you can send and receive messages through Connexis-enabled unwired ports in the same way as with normal Rose RealTime ports. 82 User Guide - Rational Rose RealTime Connexis Chapter 4 Adding Connexis Support to Your Model To add Connexis support to a Rose RealTime model complete the following sections: ■ Sharing DCS Interfaces into your Model ■ Configuring Connexis Capsules ■ Manually Integrating Transports Into a Model In addition to these steps, there are also general design rules that must be followed to ensure that the Connexis component in an application is initialized properly before it is used (see “Initializing Your Connexis Capsule” on page 92). From the perspective of a Rose RealTime model, Connexis is distributed as a set of Rose RealTime capsules and components. To make use of Connexis in your Rose RealTime model, you need to share the appropriate Connexis packages, containing the Connexis capsules and components. From a build perspective, Rational Connexis is shipped as an external library, libDCS. The libDCS library provides support for the CDM and CRM transports. User Guide - Rational Rose RealTime Connexis 83 Chapter 4 Adding Connexis Support to Your Model Sharing DCS Interfaces Connexis functionality is defined in a set of packages that must be shared into your model. There are logical packages containing the capsules that provide Connexis functionality for your application. There are also component packages representing the external Connexis libraries needed to build your application. Hint: If you want to use the CDM or CRM transport, you only need to add the Distributed Connection Service (DCS). Note: You must be able to modify your model, specifically the Logical View and Component View packages. If your model is under source control, you need to check out these packages first. Sharing DCS Interfaces into your Model In order for your application to make use of the Distributed Communication Services (DCS), you must share the DCS model interfaces packages into your model. To share the Connexis packages: 1. From the Tools menu, select Connexis > Share Connexis Packages. The Share Connexis Packages dialog appears. Figure 45 Share Connexis Packages dialog 2. Select DCS (Distributed Connection Service) model interfaces. Note: Do not select TIF (Transport Integration Framework) model interfaces unless you are developing a transport integration (see “Using the Transport Integration Framework” on page 299). a. DCS (Distributed Connection Service) model interfaces 84 User Guide - Rational Rose RealTime Connexis Configuring Connexis Capsules The DCS model interfaces selection shares the capsules and components needed to make use of DCS. The RTDInterface logical package and the RTDComponents component package are shared into your model. b. TIF (Transport Integration Framework) model interfaces Models that make use of DCS do not share this package into the model. This package is only shared into a model in which a transport integration is being developed (see “Using the Transport Integration Framework” on page 299). 3. Click Share. Removing Shared Packages Rose RealTime lets you remove Connexis packages from your model. To remove Connexis packages: 1. From the Tools menu select Connexis > Remove Connexis Packages. Connexis packages are removed from your model. Configuring Connexis Capsules Once the Connexis packages are shared, you must add a capsule role for one of the Connexis capsules in the RTDInterface package to one capsule for each component that will use Connexis. It is suggested that you add one of these capsules as a fixed capsule role in the top-level capsule in each component. If the capsule or its containing package is in source control, check the capsule out of source control before applying the settings. To add a capsule role in your model: 1. Right-click a capsule in your model or right-click the structure diagram of a capsule. 2. Select Configure Capsule for Connexis. The Configure Connexis Capsule dialog appears, containing the current Connexis settings of the selected capsule, including the type of Connexis capsule role added to the capsule. User Guide - Rational Rose RealTime Connexis 85 Chapter 4 Adding Connexis Support to Your Model Figure 46 Configure Connexis Capsule dialog 3. Check the “include DCS Capsule Role into this capsule” check box if you want to include the DCS Capsule Role into the selected capsule. If you do not, proceed to instruction five. 86 User Guide - Rational Rose RealTime Connexis Configuring Connexis Capsules 4. If you checked the “include the DCS Capsule Role into this capsule” check box, set the Configuration and Transports options to your requirements: Table 4 Configure Connexis Capsule dialog description Configuration and Transports Settings Description Transport Agent (Viewer Debugging) Selecting this option lets you use the Connexis Viewer to provide debugging support (see“Using the Connexis Viewer” on page 151). Once you select this option the CDM transport is enabled. The Connexis Viewer uses the CDM transport. Locator Functionality (Backup Primary) Selecting this option lets you use the Connexis Locator that maps endpoint service names to physical endpoints (see “Locator Connections” on page 125 and “Using the Connexis Locator Service” on page 135). CDM (Connexis Datagram Messaging) Selecting this transport lets your component use the CDM transport. CRM (Connexis Reliable Messaging) Selecting this transport lets your component use the CRM transport. 5. Select the options that you want to make available to your model. a. DCS Initialization and Control Port (see “Using the RTDInitStatus Protocol” on page 93) b. DCS Metrics Port (see “Using the Connexis Metrics Service” on page 237) Once you configure the capsule, the Connexis Component Configuration tool prompts you to configure the capsules that reference the Connexis-enabled capsule that you configured. Depending on the options that you selected in the “Configure Connexis Capsule” dialog, one of the following capsule roles are included in your capsule: User Guide - Rational Rose RealTime Connexis 87 Chapter 4 Adding Connexis Support to Your Model Table 5 Configuration Descriptions Configuration Capsule Description DCS RTDBase This configuration contains the core Connexis interfaces. With this component the Connexis Locator is not linked in with the executable and the Connexis Viewer is not used with the model. DCS with Target Agent RTDBase_Agent This configuration contains the Target Agent which is the interface between the executable and the Connexis Viewer. With this component the Viewer is used with the model but the Locator is not linked in with the executable. DCS with Locator RTDBase_Locator This configuration contains the Connexis Locator. With this component, the Locator is linked in with the executable but the Viewer is not used with the model. DCS with Target Agent and Locator RTDBase_Locator_ This configuration contains both the Agent Locator and the Target Agent. With this component, the Locator is linked into the executable and the Connexis Viewer can be used with the model. Manually Integrating Transports Into a Model This section explains how to integrate transports into your model without using the Configure Connexis Capsules tool. For a transport to be available for use in a DCS enabled model, the transport must first register with DCS, prior to the initialization of DCS. This constraint also applies to the CDM or CRM transports. The RTDCdm and RTDCrm classes in the RTDInterface logical package represent the CDM and CRM transports respectively. The constructors of each of these classes register their respective transport with DCS. As 88 User Guide - Rational Rose RealTime Connexis Configuring Connexis Capsules a result, an instance of the class must be created prior to the initialization of the DCS. The easiest way to ensure this is to create an association (composite aggregation) between the capsule containing the DCS capsule and the classes that represent the transports to be integrated. To register the CDM transport for use in the model, create an association (composite aggregation) of type RTDCdm on the capsule containing the RTDBase or RTDBase_Locator capsule. The RTDBase_Agent and RTDBase_Agent_Locator capsules automatically register the CDM transport, since the viewer uses the CDM transport. The constructor for RTDCdm accepts an argument of type bool indicating whether the CDM transport should listen on the transporter's thread for incoming messages ("true") or on a separate thread ("false"). Listening for messages on the transporter's thread can provide better performance. Only one transport can listen on the transporter's thread for messages. If the argument supplied to the constructor is "true" and another transport has already registered with DCS to listen on the transporter's thread, CDM will listen on a separate thread. To register the CRM transport for use in the model, create an association (or attribute + dependency) of type RTDCrm on the capsule containing the RTDBase, RTDBase_Locator, RTDBase_Agent and RTDBase_Agent_Locator capsule. The constructor for RTDCrm accepts a bool indicating whether the CRM transport should listen on the transporter's thread for incoming messages ("true") or on a separate thread ("false"). Listening for messages on the transporter's thread can provide better performance. Only one transport can listen on the transporter's thread for messages. If the argument supplied to the constructor is "true" and another transport has already registered with DCS to listen on the transporter's thread, the CRM will listen on a separate thread. If your model is using additional transports that have been integrated into DCS, they must also be registered with DCS prior to the initialization of DCS. The designers that developed the transport integration will be able to provide information on how to register the transport. User Guide - Rational Rose RealTime Connexis 89 Chapter 4 Adding Connexis Support to Your Model Configuring a Component for Connexis When you configure a component for Connexis, you create a component dependency to a DCS library. If a DCS dependency already exists in the selected component, the Configuration tool notifies you of the existing dependency. To configure a Component for Connexis: 1. Right-click a component. 2. Select Connexis > Configure Component. The “Component Diagram Selection” dialog appears. Note: A DCS capsule role must be in one of the capsules referenced by the component before you configure the component (see “Configuring Connexis Capsules” on page 85). 3. Select how you want the changes to be displayed. 90 User Guide - Rational Rose RealTime Connexis Verifying Connexis Enabled Components The dialog lists the display options available for the selected component. Table 6 Component Diagram Selection options Options Description < > creates a component dependency to the DCS library, without a diagram displaying the changes. < > creates a new diagram showing the component dependency to the DCS library. Existing component diagram shows the component dependency to the DCS library from an existing diagram. Note: A component may also be configured from the menu on its view in a component diagram. Verifying Connexis Enabled Components Once you have shared Connexis components in your model, you can verify the model path and incompatibilities of each component in your model. User Guide - Rational Rose RealTime Connexis 91 Chapter 4 Adding Connexis Support to Your Model To verify a component: 1. Right-click a component. Note: You can select several components at a time by pressing the Ctrl key. 2. Select Connexis > Verify . The “Component Verification Results” dialog appears. Figure 47 Component Verification Results 3. Select a component from the “Components” area. The “Model Path” information and “Incompatibilities” information are displayed. Initializing Your Connexis Capsule The Connexis capsule that you are using in your application must be initialized before any ports can be registered with it. There are two approaches that can be used to make sure that the Connexis component is initialized before it is used in the application: ■ 92 Use the RTDInitStatus protocol. This is the recommended approach and will work in all configurations. User Guide - Rational Rose RealTime Connexis Initializing Your Connexis Capsule ■ Use fixed initialization order. This approach will work in the most basic configuration, which is when the Connexis component is fixed and on the main application thread. This approach will not work when the Connexis component is created on a different thread. Using the RTDInitStatus Protocol The recommended approach for ensuring the Connexis component is initialized before use is to subscribe to the RTDInitStatus publisher on the Connexis component and query DCS as to its status. If the Connexis component is initialized on a thread other than the main thread, this approach is required because there is no other way to ensure the Connexis component is initialized before use. All of the Connexis components publish a port called RTDInitStatus. This port realizes the RTDInitStatus protocol. When the component is fully initialized, it sends an rtBound event on this port. When rtBound is received the DCS initialization was successful. All of the capsules that are planning to register ports with the Connexis component must create a subscriber port that realizes the RTDInitStatus protocol. This port must be registered as RTDInitStatus and notification must be turned on. Once the Connexis component has been initialized, it will send an rtBound event on the RTDInitStatus port. The code used to register the subscriber port (if application registration is used) is as shown below: rTDInitStatus.registerSAP(“:RTDInitStatus”); If automatic registration is used, the port must be protected and the registration override string must be defined as: :RTDInitStatus For an example of using the RTDInitStatus protocol, refer to the HelloWorld model in the examples directory ($ROSERT_HOME/CONNEXIS)/C++/examples. The RTDInitStatus protocol also defines an interface that provides the following: ■ access to the status of the Target Agent and Locator if present ■ query which port the CDM is listening on User Guide - Rational Rose RealTime Connexis 93 Chapter 4 Adding Connexis Support to Your Model ■ access to the DCS Transport thread, and its Virtual Circuit limit ■ ability to set the primary and backup locator endpoints dynamically at run-time This interface is asynchronous, and is defined in more detail in Table 7 and Table 8. Table 7 summarizes the output signals that can be sent by the application. Table 8 summarizes the input signals that can be received by the application. Table 7 RTDInitStatus Out Signals Out Signal Description rtdAgentActive Request for Target Agent activation status. rtdBackup Endpoint Used to set the endpoint of the backup locator. The data is the endpoint string, in the same format as the CNXlbep command line argument. e.g., cdm://localhost:4000, or tcp://192.139.251.2:5000, etc. rtdCDMport Request for the value of the CDM port assigned. rtdDCSrunning No longer supported. rtdLocator Available Request for Locator availability status. If the Locator has been loaded into the system and properly configured it will be flagged as available. rtdPrimary Endpoint Used to set the endpoint of the primary locator. The data is the endpoint string, in the same format as the CNXlpep command line argument. e.g., cdm://localhost:4000, or tcp://192.139.251.2:5000, etc. 94 rtdTransport Controller Request for the Transport handle. This handle is required for high-performance DCS applications that will be collocated on the same thread as the Transport. rtdVClimit Request for internal limit on the number of Virtual Circuits (VCs). This limit is defined by the version of the library. User Guide - Rational Rose RealTime Connexis Initializing Your Connexis Capsule Table 8 RTDInitStatus In Signals In Signal Description rtdAgentActiveReply No longer supported. rtdBackupEndpoint Reply Reply to rtdBackupEndpoint containing the status of setting the backup locator endpoint, returned as an int. int result = *rtdata; The result is one of the following: 0 - success 1 - failed because this process is the backup locator 2 - failed due to an invalid endpoint string rtdCDMportReply Reply to rtdCDMport containing the CDM port assigned, returned as an int. The CDM port is derived either from the value for CNXep, or from a free port number. int cdm_port = *rtdata; A non-zero value indicates a software failure. rtdDCSrunningReply Reply to rtdDCSRunning containing the status of DCS, returned as an int. int dcs_status = *rtdata; A non-zero value indicates that DCS is running. User Guide - Rational Rose RealTime Connexis 95 Chapter 4 Adding Connexis Support to Your Model Table 8 RTDInitStatus In Signals In Signal Description rtdLocatorAvailable Reply Reply to rtdLocatorAvailable containing availability status, returned as an int. int locator_available = *rtdata; A zero value implies that the locator is NOT properly configured and the registration of global names will fail: port-name.registerSAP("dcs:/service-name") // will fail port-name.registerSPP("dcs:/service-name") // will pass since SPPs can also be connected to locally and explicitly. A non-zero value indicates that the Locator is properly configured though a connection may not exist at this time to a remote Locator. Registration of global names will pass. Possible return values: 1 == Primary Locator running locally (this process), Backup Locator not configured 2 == Primary Locator running locally (this process), Backup Locator is remote (CNXlbep) 3 == Backup Locator running locally (this process), Primary Locator is remote (CNXlpep) 4 == Primary Locator is remote (CNXlpep), Backup locator not configured 5 == Primary Locator is remote (CNXlpep), Backup locator is remote (CNXlbep) 96 User Guide - Rational Rose RealTime Connexis Initializing Your Connexis Capsule Table 8 RTDInitStatus In Signals In Signal Description rtdPrimaryEndpoint Reply Reply to rtdPrimaryEndpoint containing the status of setting the primary locator endpoint, returned as an int. int result = *rtdata; The result is one of the following: 0 - success 1 - failed because this process is the primary locator 2 - failed due to an invalid endpoint string rtdTransportController Reply to rtdTransportController containing the Reply Transport handle, returned as a (RTController *). This handle is needed to initialize capsules on the dcs: Transport thread. RTController * t_thread = (RTController *)*rtdata; A null pointer is returned if DCS is not running. rtdVClimitReply Reply to rtdVClimit containing the VC (virtual circuit) limit, returned as an int. int vc_limit = *rtdata; User Guide - Rational Rose RealTime Connexis 97 Chapter 4 Adding Connexis Support to Your Model Using Fixed Initialization Order If the Connexis component’s capsule role is fixed and is created on the main application thread, you can ensure that it is initialized before it is used by other capsules by placing it in the application’s top capsule and putting the Connexis component’s capsule role at the top of the initialization order for that capsule. Note: If the Connexis component’s capsule role is created on a thread other than the main thread or is optional and on the main thread, this approach is not guaranteed to work. To ensure that the Connexis component’s capsule role is initialized before any capsule roles that register with Connexis: 1. Make the Connexis component’s capsule role fixed and place it in the top-level capsule of the application. 2. Open the Capsule Specification dialog for the top-level capsule. 3. Select the Capsule Roles tab. 4. Move the Connexis component’s capsule role so that it is in the list before any capsule roles that register with Connexis. You can do this by dragging and dropping the appropriate capsule role to the top of the list of capsule roles. The resulting dialog is shown in Figure 48. Note: If you sort the list of capsule roles by clicking on one of the column headings, you will not be able to determine the initialization order until you close and reopen the specification dialog. 98 User Guide - Rational Rose RealTime Connexis Converting Connexis Version 2000.02.10 Models to Connexis 2001A.04.00 Models Figure 48 Capsule Role tab of top-level capsule Converting Connexis Version 2000.02.10 Models to Connexis 2001A.04.00 Models If you are using the previous version of Connexis (version 2000.02.10), the Connexis Model Conversion Tool searches your model, identifying any incompatibilities, and provides a detailed description, explaining the changes. Table 9, Model Conversion for Connexis 2000.02.10 to Connexis 2001A.04.00, explains the changes that are made to your model during the conversion process. User Guide - Rational Rose RealTime Connexis 99 Chapter 4 Adding Connexis Support to Your Model Table 9 Model Conversion for Connexis 2000.02.10 to Connexis 2001A.04.00 Condition Change RTDXBase, RTDXBase_Agent, RTDXBase_Locator, RTDXBase_Agent_Locator fixed capsule roles are in the model Replaces the capsule roles with the corresponding RTDBase configuration. Integrates the CDM transport with the capsules containing the new RTDBase or RTDBase_Locator capsule roles. Integrates the CRM transport into the containing capsule. RTDBase, RTDBase_Locator fixed capsule roles are in the model but do not have the CDM transport as an attribute. Integrates the CDM transport using a composite aggregation relationship into the capsules containing RTDBase or RTDBase_Locator capsule roles. RTDXBase optional Converts to the RTDBase and integrates the capsule role is in the model CRM and CDM transports. RTDXBase_Agent optional Converts to RTDBase_Agent and integrates the capsule role is in the model CRM transport. RTDXBase_Locator optional capsule role is in the model Converts to RTDBase_Locator and integrates the CDM and CRM transports RTDXBase_Locator_Agent optional capsule role is in the model Converts to RTDBase_Locator_Agent and integrates the CRM transport. Users are notified that the CDM transport is RTDBase or RTDBase_Locator optional integrated. capsule role is in the model RTDBase_Agent or RTDBase_Locator_Agent optional capsule role is in the model 100 Searches the model identifying any of the components that reference a dependency. If a dependency exists, the CRM transport is integrated. User Guide - Rational Rose RealTime Connexis Converting Connexis Version 2000.02.10 Models to Connexis 2001A.04.00 Models Table 9 Model Conversion for Connexis 2000.02.10 to Connexis 2001A.04.00 Condition Change A component depends on a Changes the component dependency to use the XDCS library component DCS library component. Removes the -CNX- or -CNX-M from the The TargetConfiguration TargetConfiguration name. property of a component references a -CNX-M or a CNX- target configuration To convert your model: 1. Open a model that uses the previous version of Connexis (version 2000.02.10). 2. Select Tools > Connexis > Convert Model. The “Convert Model” dialog appears. Figure 49 Convert Model dialog 3. View more information about incompatible capsules and components by selecting the capsule or the component from the dialog and clicking More Information . User Guide - Rational Rose RealTime Connexis 101 Chapter 4 Adding Connexis Support to Your Model The “Element Information” dialog appears. Figure 50 Element Information dialog The “Element Information” dialog provides the following information: Table 10 Element Information dialog chart Information Heading Description Model Path Shows the path of the selected capsule or component. Description of Incompatibility Explains the reason for the incompatibility between version 2000.02.10 and 2001A.04.00. Suggested Course of Action Explains how the Conversion tool will make the capsule or component compatible with Connexis version 2001A.04.00. 4. Click OK once you have read the information, and repeat step three for additional capsules and components that appear in the “Convert Model” dialog. 5. Click 102 Auto-Convert All from the “Convert Model” dialog. User Guide - Rational Rose RealTime Connexis Converting Connexis Version 2000.02.10 Models to Connexis 2001A.04.00 Models The Conversion Tool converts the incompatible capsules and components in your model. As the conversion takes place, the Conversion Tool may prompt you to confirm some conversion changes. Note: Only run the Conversion Tool once. If you run the tool a second time, the information displayed in the Convert Model dialog may not be accurate. Verifying Component Compatibility with Connexis Version 2001A.04.00. The Component Verification Tool verifies that a component is compatible with Rational Connexis version 2001A.04.00. To verify that a component is compatible with version 2001A.04.00: 1. Right-click a component. 2. Select Connexis > Verify. The “Component Verification Results” dialog appears. Figure 51 Component Verification dialog 3. Select the component from the “Components” area. The model path and the incompatibilities for the selected component appear. User Guide - Rational Rose RealTime Connexis 103 Chapter 4 Adding Connexis Support to Your Model 4. Open the component from the browser and fix the incompatibilities. Note: You do not have to close the Component Verification Results dialog while fixing the incompatibilities. 5. Click OK. RTDErrorType Error Reporting Connexis reports error types that are defined in the enumerated RTDErrorType class. To access these errors, define an input signal named rtdError with data type RTDErrorType, in the protocol class of the port to be registered with DCS. If any of the following errors occur, the port receives an rtdError message with the error type as data (see Table 11). Table 11 104 RTDErrorType Error Reporting Output Description rtdDCSUninitialized = 1 Registration failed because DCS was not initialized. rtdZeroReplication = 2 Registration failed because the replication factor of the port is zero. rtdInvalidSyntax = 3 Registration failed because the registration string was of invalid syntax. rtdInvalidTransport = 4 Registration failed because the specified transport is not supported by this component. rtdCircuitUnavailable = 5 Registration failed because no virtual circuit is currently available for the remote binding. rtdLocatorUnavailable = 6 Global registration failed because no locator is available. User Guide - Rational Rose RealTime Connexis Converting Connexis Version 2000.02.10 Models to Connexis 2001A.04.00 Models Table 11 RTDErrorType Error Reporting Output Description rtdConnectTimeout = 7 Explicit registration failed because a connection could not be established with the remote endpoint. rtdEndpointUnavailable = 8 A connection cannot be made at present with the remote endpoint because it is currently unavailable. rtdEndpointInaccessible = 9 A connection can never be made with the remote endpoint. Note: The last two errors can occur after a successful registration and bind. For that reason they are sent at Background priority. All other errors are sent at General priority. User Guide - Rational Rose RealTime Connexis 105 Chapter 5 Establishing Connections Establishing Connections provides information to help you decide how you plan to distribute your application and how you can use Connexis to set up connections: ■ General Connection Patterns - provides information about client/server and peer to peer connection patterns. ■ Unwired Port Registration - provides information about registration, automatic versus application registration, and registration parameters. ■ Name Resolution - describes how Connexis resolves host names. ■ Connexis Connection Options - describes how Connexis handles publisher/subscriber connection patterns. The three methods of establishing connections: local, explicit endpoint, and Locator connections are discussed. ■ Registration Summary - provides several examples explaining how to use registration strings successfully. ■ Connection Design Heuristics - provides a summary of connection design principles and how they are handled by Rose RealTime and Connexis. Replicated publisher ports, invokes, broadcast sends, notification, defers and sending data between capsules are discussed. User Guide - Rational Rose RealTime Connexis 107 Chapter 5 Establishing Connections General Connection Patterns In the broadest sense there are two connection patterns that can be implemented by an application: ■ client/server ■ peer to peer These two patterns are not mutually exclusive. A capsule that is participating in one connection as a client is not limited to that role. It could be participating as a client in one connection and a server in another. The same capsule may also be involved in several peer to peer connections with different capsules. Client/Server The client/server pattern is used to describe a connection topology in which there is a service provider that is capable of providing services to two or more capsules. In Figure 52, the ServerCapsule supports three connections on its clientServer port. Each of the client capsules only supports one. In this example, the distinction between the server and the client is that the server publishes its service, and the client subscribes to it. In Rational Rose RealTime, unwired public and protected ports can each play the role of the publisher or subscriber. 108 User Guide - Rational Rose RealTime Connexis General Connection Patterns Figure 52 Client / server pattern In scenarios where Automatic registration is used, this is configured by selecting the Publish checkbox in the Port Specification dialog box. For more information, refer to the “Rational Rose RealTime Toolset Guide.” In scenarios where Application registration is used, publishers use the registerSPP operation and subscribers use the registerSAP operation. Peer to Peer With the peer to peer connection pattern, one capsule is connected to one other capsule and they pass messages back and forth between each other. Even though the two capsules are peers in the communication, one of them must be responsible for publishing its interface and the other for subscribing to the interface. User Guide - Rational Rose RealTime Connexis 109 Chapter 5 Establishing Connections In Figure 53, Peer1 is connected to both Peer2 and Peer3 in different connections through different unwired ports. In both of the connections, one of the capsules must play the role of the publisher and the other the role of the subscriber. Figure 53 Peer to peer connection pattern Unwired Port Registration There are three ways to establish a connection using Connexis: ■ locally - within the same process ■ external explicit - between processes, using an explicit endpoint address ■ locator - within the same process or between processes using a name lookup service The registration string that is used when the port is registered with the Target RSL determines which of these methods is used. 110 User Guide - Rational Rose RealTime Connexis Unwired Port Registration What is Registration? In Rose RealTime, unwired ports must be registered with the Target RSL. This registration can be accomplished either automatically, or dynamically through application code. The choice as to which registration method is to be used is set in the specification dialog for the unwired port. This setting is illustrated in Figure 54. Figure 54 Port specification dialog In Figure 54, the Wired check box is not selected. This means that the port must be registered using one of the two methods outlined. If the Automatic registration check box is checked, the port will be registered automatically using the name provided in the Registration override field. If no text has been entered into the Registration override field, the port will be registered under its own name with the ILS. If the Publish User Guide - Rational Rose RealTime Connexis 111 Chapter 5 Establishing Connections checkbox is checked, the capsule will publish this interface. If the Publish checkbox is not checked, the capsule will request to subscribe to this interface. If the Application registration check box is checked, it is assumed that the registration of the port will be handled by the application code. In this case, the Registration override field is ignored. Port API To register ports dynamically, you must use the functions that are provided on the Rose RealTime port objects. The RTProtocol class implements the concept of a port role in Rose RealTime. At design time, when you create a port role on a capsule, it corresponds to an instance of RTProtocol. The API provided by the Rose RealTime port objects to manage the registration of the ports is implemented on the RTProtocol class. For more information, refer to the “Rational Rose RealTime Toolset Guide.” The RTProtocol class provides the functions required for registration and deregistration of unwired ports. Each function along with a brief description of its responsibilities is presented in the following table. Table 12 112 RTProtocol interface Function Description registerSAP(serviceName : const char*) : int Register a subscriber side port with the connection service using the supplied serviceName. The connection service is either the ILS or DCS. Returns a 1 on success or a 0 on failure. deregisterSAP( : void) : int Deregisters a previously registered subscriber side port. Returns a 1 on success or a 0 on failure. registerSPP(serviceName : const char*) : int Register a publisher side port with the connection service, using the supplied serviceName. The connection service is either the ILS or DCS. Returns a 1 on success or a 0 on failure. deregisterSPP( : void) : int Deregisters a previously registered publisher side port. Returns a 1 on success or a 0 on failure. isRegistered( : void) : int Returns a 1 if the port is registered, or a 0 if the port is not registered. User Guide - Rational Rose RealTime Connexis Unwired Port Registration Table 12 RTProtocol interface Function Description getRegisteredName( : void ) : const char* Returns the service name that was used to register the current port. If the port is not registered, a null pointer is returned. bindingNotification( on_off : int ) : Sets the binding notification of the port to void either on (1) or off (0). This is used to programmatically set the notification property of a port. bindingNotificationRequested( : void ) : int Returns 1 if the port has notification turned on or returns 0 if the port has notification turned off. Automatic vs. Application Registration There are two ways to register a port. The first is to specify that the registration be completed automatically. This instructs the Target RSL to register the unwired port with the connection service using the name that was given to the port or with the specified Registration override. This approach is illustrated in Figure 55. User Guide - Rational Rose RealTime Connexis 113 Chapter 5 Establishing Connections Figure 55 Automatic port registration In this case, the port is registered using the string that was provided in the Registration override field (“dcs:cdm://host1:14500/init”). Since the Publish checkbox is not checked, it is a subscriber. If no override had been provided, the port would have been registered using the port’s name (pInitialize). The second approach is to specify that the registration be completed by the application, and to then register the port through application code using the RTProtocol interface described in “Port API” on page 112. The port specification for implementing this registration method is shown in Figure 56. 114 User Guide - Rational Rose RealTime Connexis Unwired Port Registration Figure 56 Application port registration When this registration method is used, a registration string similar to what is shown in the “Registration override:” field in Figure 55 must be specified as the argument to the registerSAP() or registerSPP() RTProtocol API function, somewhere in the state machine of the capsule. For example, code similar to the following could be written in the initial transition. pInitialize.registerSAP(“dcs:cdm://host1:14500/init”); Registration Parameters There are often cases where extra information may be required when registering a port with the connection service. Connexis supports passing parameters as part of the registration string. These parameters take the form of tagged-value pairs. The specification string is enclosed in a pair of delimiters. Each tag-value pair is also enclosed in a pair of delimiters. For example: User Guide - Rational Rose RealTime Connexis 115 Chapter 5 Establishing Connections ((tag1,value1)(tag2,value2)) The “(“ and “)” characters are used as tag-value pair delimiters, and also as delimiters to the entire parameter list. The “,” is used to separate the tag and the value in a tag-value pair. Supported parameters For subscribing, Connexis provides registration options to set the transport for global registrations and to specify the quality of service parameters for a connection setup. For publishers, Connexis provides a registrations option to assign a rank to a publisher. The details of these registration parameters are outlined in Table 13. 116 User Guide - Rational Rose RealTime Connexis Unwired Port Registration Table 13 Supported registration parameters Parameter Name Description locator_transport This parameter specifies the transport that is to be used by the subscriber to connect to a publisher. Type: string Possible values: cdm, crm and any integrated transports locator_rank This parameter specifies the rank of the publisher that is being registered. This parameter only works for ports that are publishers. The higher the number, the higher the rank. If the rank is not specified, the default rank is zero. Type: integer Possible values: any integer >= 0 connect_retries This parameter specifies the maximum number of times that DCS attempts to send a connect message to a remote endpoint to establish a connection. The default, without the option, is infinity. The maximum connect timeout interval is equal to (1 + connect_retries) * CNXdcrd. If connect_retries equals zero, then the maximum timeout is therefore CNXdcrd. If connect_retries equals one, then the maximum timeout is therefore 2 * CNXdcrd, etc. If no connect acknowledgment is received within this timeout interval, a rtdError message with enumerated data rtdConnectTimeout is sent to the application. If the transport timeout interval is shorter than the maximum connect retry interval, a rtdError message with enumerated data rtdEndpointUnavailable may be sent to the application instead. User Guide - Rational Rose RealTime Connexis 117 Chapter 5 Establishing Connections Registration parameter examples The first example registers a subscriber port with “cdm” as the preferred protocol. port1.registerSAP(“dcs:/service1 ((locator_transport, cdm))”); This example registers a publisher port with the specified rank. port2.registerSPP(“dcs:/service1 ((locator_rank, 1))”); Name Resolution Whenever an endpoint is registered using a host name instead of an IP address, Connexis will translate the host name into a valid IP address. On development workstations this will typically be done through a Domain Name Service (DNS). Since the call to the DNS is blocking, Connexis performs this operation using a separate thread, called a helper thread. The following points describe the algorithm that is used by Connexis to resolve host names: 1. An attempt is made to resolve the host name. 2. If the host name cannot be resolved, the name resolution will be retried periodically until it is resolved successfully. Host names that have been resolved are cached for a number of seconds. This means that if a resolution request is made for a host name that had just been looked up, the result from the last lookup will be returned. Connexis Connection Options Connexis is able to handle the connection patterns listed in General Connection Patterns, as well as other connection topologies common in distributed systems. It does this using the publisher/subscriber pattern. With this pattern, every virtual circuit in a Connexis model has a publisher at one end of the communication channel and a subscriber at the other end. The publisher publishes its interface with the connection service (or the locator) and the subscriber subscribes to that interface. At the highest level, there are three different ways that connections can be established using Connexis: ■ 118 locally - connect to another object within the same executable User Guide - Rational Rose RealTime Connexis Connexis Connection Options ■ external using an explicit endpoint - connect to an object in another executable using an explicit endpoint ■ using the locator service - connect to an object using the Locator service to resolve the endpoint address Local Connections Rose RealTime has a built-in connection service called the Internal Layer Service (ILS). The ILS is used to connect unwired ports within the same executable, or to be more precise, within the same instance of the Rose RealTime Run-time Service Library (Target RSL). The ILS establishes the connection between two local unwired ports. Registering ports locally is the simplest of the three registration types but it is also the least flexible. When a port is registered with the ILS, it cannot send or receive messages to or from ports in another executable model. In addition to establishing local connections using the ILS, you may also use Connexis to accomplish the same thing. Using Connexis to establish local connections has the following advantages: ■ Connexis supports multiple publishers with the same registration name (the ILS does not) ■ Connexis allows you to establish loopbacks that can be used to fully trace the message flow between the connected ports. This can be very useful for debugging an application. Local connection examples This section presents two examples: ■ local connection with DCS using automatic registration ■ local connection with DCS using application registration User Guide - Rational Rose RealTime Connexis 119 Chapter 5 Establishing Connections Example 1: Local connection, ILS, automatic registration and override This example illustrates how to register an unwired client side port and a corresponding server side port using automatic registration. This example implements a simple initialization controller. The controller is responsible for making sure that the components of an application are initialized in a predetermined order. The structure for the initialization controller is shown in Figure 57. Figure 57 120 Class diagram of initialization controller User Guide - Rational Rose RealTime Connexis Connexis Connection Options In this structure, the initialization controller capsule requires a connection to each of the capsules in the application. These connections are required so that it can send initialization messages to each of the capsules. If this application exists completely in a single executable, the initialization controller could connect to each component through a wired port. This implementation may cause the following problems: ■ The structure is unnecessarily complex as a result of having to show all of the physical connections between the different capsules. ■ The structure is not as flexible. More effort is required to separate some of the components out into separate applications. For these reasons, the pattern is better modeled using unwired ports. To automatically register the ports in this example for each initialization port: 1. Select the port and open its specification dialog. 2. Uncheck the Wired option. 3. If the port is being published (that is, server in a client/server distribution pattern), check the Publish checkbox. 4. Select the Automatic registration option. 5. If notification is being used, check the Notification check box. 6. Type in a DCS Registration string in the Registration override field. User Guide - Rational Rose RealTime Connexis 121 Chapter 5 Establishing Connections Figure 58 Specifying automatic registration As mentioned in the Connexis Quick Start, the convention usually followed is to conjugate the port that is being published (this would correspond to the server in the client/server distribution pattern). The reason for this is twofold: ■ By following a convention, the naming of protocols and signals will be consistent throughout the model. ■ It requires fewer steps in a client/server pattern because only the one server port needs be conjugated (instead of all of the clients). In this case, the registration name is overridden by entering “dcs:init” in the Registration override field. This means that this port is registered with the DCS with the name “init”. Since the Publish option is selected, the port is published. If nothing is entered in the Registration override field, the port name, pInitialize, is used and is registered with the ILS. Automatic registration using the DCS requires registration override; otherwise, it defaults to the ILS 122 User Guide - Rational Rose RealTime Connexis Connexis Connection Options If you register your ports with the DCS (instead of the built-in ILS) and you are making use of the Locator service, you will not have to make changes to the registration string if one side of the connection is moved to a different process. Example 2: Local connection and application registration This example illustrates registering an unwired client port and a corresponding server port using application registration. This example uses the same sample capsules as the previous example. In this case, the ports are defined as application registration as shown in Figure 59. Figure 59 Specifying application registration When a port is registered using application registration, the Registration override field is ignored and the functions described in the port API must be used to register the port with the connection service. User Guide - Rational Rose RealTime Connexis 123 Chapter 5 Establishing Connections The code required to register the port with the DCS is written as follows: pInitialize.registerSPP(“dcs:init”); The above line of code registers the pInitialize port with the DCS using the “init” service name. External Explicit Connections External explicit connections are connections that: ■ are made with capsules that are running in another process, either on the same processor or a different processor on the network ■ the name of the endpoint is known at design time or can be specified at run-time through a configuration file or command line argument Explicit connections are typically used in a fixed network environment where the network configuration is known and rarely changes. Using explicit connections is less flexible than making use of a Locator service, but in cases where the network addresses and endpoint names are known, it is a smaller (memory wise) and faster approach. The decision to use either the Locator service or explicit connections depends mostly on the requirements of the application and the network configuration that it will be running in. External explicit examples With explicit connections, more information must be known by the applications about the other side of the connection. Each subscriber must know or be able to find out the explicit endpoint addresses of all of the other objects that it wants to subscribe to. Registering the publisher side of the connection is similar to the local and Locator cases. The connection service and the service name are all that is required. When starting the publisher component instance, you usually specify endpoints on which it will be listening. The subscriber side of the connection is quite a bit different. In this case, you must know the endpoint address of the publisher and specify it in the registration string. 124 User Guide - Rational Rose RealTime Connexis Connexis Connection Options Queueing of Subscriptions If a subscriber registers before a transport connection has been established to the remote endpoint, the DCS repeatedly attempts to establish a connection to the remote endpoint. If the "conn_retries" registration option has not been specified in the registration string, the DCS will try to establish the connection until the port is deregistered. If a connection to the remote endpoint is established, but the registration takes place before the service is published at the remote endpoint, the registration is left pending until a service is published or the subscribing port is deregistered. Using the CDM transport protocol The publisher application would perform the following: .registerSPP(“dcs:myService”); Assuming that the myService publisher is started on node “host2”, and is listening on port 45678, the following registration string is used by the subscriber: .registerSAP(“dcs:cdm://host2:45678/myService”); This tells Connexis to try to connect to port 45678 on host2 to get to the desired publisher. The format of the string is defined by the BNF Registration String Grammar. For more information, see “Registration String Grammar” on page 245. For this example to work properly, the application in which the publisher is running must be started using the following CNXep command line parameter: -CNXep=45678 Locator Connections The most flexible way of registering unwired ports is to use the Locator service. The Locator service maps endpoint service names to physical endpoints on the network. This enables applications to not be intimately aware of the network topology, which also means that they do not have to change when the network topology changes. User Guide - Rational Rose RealTime Connexis 125 Chapter 5 Establishing Connections The Connexis Locator is implemented as a Rose RealTime Connexis component. Unwired ports register (subscribe or publish) themselves with the Locator instead of the connection service. The Locator is then responsible for finding the appropriate endpoints and insuring that they are bound together. Using the Locator is similar in nature to using local connections, you register a service name for the port with the Locator and the rest is handled for you. The key differences between using the Locator and using local connections are: ■ A Locator component (RTDBase_Locator, or RTDBase_Locator_Agent) must be included in the executables that are implementing the Locator (either primary or backup). ■ The Locator service must be started when the Locator is being used. This means that a primary Locator must have been configured using the -CNXlp configuration option on the Locator process, and the client processes must be started with the -CNXlpep configuration option, which specifies the address of the primary Locator. ■ The registration string is slightly different. Instead of using a string with the syntax, dcs: you must use a string with the syntax, dcs:/ . This registration string registers the port with the DCS and with the Locator. When a subscriber is registered using this registration string syntax, it first looks for a local publisher to which to connect. If it finds a local publisher with the service it is looking for, it will connect to it. If no local publisher is found, it subscribes to the Locator service. Locator examples To register a publisher named QueryState using the Locator, the following registration string would be used: port1.registerSPP(“dcs:/QueryState”); To register a subscriber that subscribes to the same QueryState service, the following registration string is used: port2.registerSAP(“dcs:/QueryState”); 126 User Guide - Rational Rose RealTime Connexis Registration Summary Note that this example assumes that the applications have been started using the appropriate command line arguments and the RTDBase_Locator capsule has been dragged into the application providing locator services. Registration Summary This section presents several registration scenarios and explains what registrations strings will succeed and fail in each. The important points to realize about Connexis registration are: ■ Ports that are registered with the ILS are registered in a different namespace than those that are registered with the DCS. This means that a subscriber port registered as:test1 will not bind with a publisher registered as dcs:test1. ■ Ports that are registered with the Locator are also implicitly registered with the DCS. This means that they will bind with locally registered DCS ports and also explicit DCS ports with the same service name. ■ Ports that are registered with the registration string “servicename” (as opposed to “:servicename” or “dcs:servicename”) share the same namespace as ports that are registered with the ILS (“:servicename”). This type of registration is present for backwards compatibility reasons only, and as a result, is not discussed in this section. All of these examples assume that the publisher is replicated, that is, it can support the number of subscribers that are trying to connect to it. Scenario 1: Publisher Registered with the ILS In this scenario, a publisher (port2) is registered with the ILS and two subscribers (port1 and port3) attempt to make connections to the publisher. User Guide - Rational Rose RealTime Connexis 127 Chapter 5 Establishing Connections Figure 60 Scenario 1: Registering ports with the ILS In this scenario, port1 will connect to port2 but port3 will not. This is because port2 has been registered with the ILS which is only capable of connecting ports locally. Port2 would also not be capable of receiving explicit or locator connections from a different process. Scenario 2: Publisher Registered with the DCS In this scenario, the publisher is registered with the DCS. Several subscribers, each registered using different methods, attempt to establish connections to the subscriber. 128 User Guide - Rational Rose RealTime Connexis Registration Summary Figure 61 Publisher registered with DCS Note: In this scenario the location of the Locator Service is not relevant to the outcome of the registrations. In this scenario, port2 registers with the DCS. Also, port1 connects to port2 by forming a local DCS connection. Port3 and port4 also connect because, by registering with the DCS, port2 is capable of receiving both local DCS connections and explicit connections (whether they are internal or external). In this scenario, the only registration string that will not result in a successful connection being established is the one that is used to register port5. This registration string is looking to the Locator to resolve the endpoint name. Since port2 did not register with the Locator, no compatible publisher will be found for port5. Note: A local DCS connection is an intra-process connection that is using the DCS instead of the ILS. As with ILS connections, local DCS connections, once bound, have the same run-time performance as connections that are bound at design time. User Guide - Rational Rose RealTime Connexis 129 Chapter 5 Establishing Connections Scenario 3: Publisher Registered with the Locator In this scenario, the publisher (port1) registers with the Locator Service. Several subscribers, each using a different registration string, attempt to establish connections to the publisher. Figure 62 Publisher registered with the Locator Note: In this scenario, the location of the Locator Service is not relevant to the outcome of the registrations. In this scenario, the publisher (port1) is registered with the Locator Service. The interesting aspect of this type of registration is that registering with the Locator Service implicitly registers the port with the DCS. This means that subscribers can make explicit (either local or remote) connections to a publisher that was registered with the Locator Service. Port2 and port3 will both successfully connect to port1 since they use the Locator. port4 will also connect because it is specifying the endpoint explicitly. Port5 will not be connected, since it is registering locally with the DCS. 130 User Guide - Rational Rose RealTime Connexis Connection Design Heuristics Multiple Publishers Unlike the ILS, Connexis supports multiple publishers with the same registration name. The ILS restricts the naming of unwired ports that are publishing themselves, so that each published unwired port must be named uniquely. The port can be replicated but two capsules cannot have published ports with the same name. This restriction is removed when using Connexis. Multiple capsules can have published unwired ports that use the same registration string. This can be very useful for distributing the load in a distributed system. For example, if the application being built has a service provider that offers a database lookup service, Connexis could be used to distribute this service between two or more capsules running on separate processors in the network. This can also be modeled locally without having to change any code when the distributed version is released. This can be accomplished by using the Locator service or by reading a configuration file that contains the endpoints of the different components. Connection Design Heuristics When to Use Replicated Publisher Ports This is a common design pattern. It is very common in real-time and non-real-time systems, for a single software element to provide services to multiple others. A very common example of this is a web server. When you connect to a website, like www.rational.com, you are connecting to a server process that is running on the host machine. The server process is listening on a particular TCP/IP port and when a request comes in, it spawns a task to handle that particular client interaction. Multiple clients can connect to www.rational.com at the same time. One thing to be careful of when using replicated publishers (or multiple publishers with the same name) is to make sure that the number of publishers is appropriate for servicing the number of subscribers. If the number of subscribers is significantly greater than the number of publishers thrashing could occur. User Guide - Rational Rose RealTime Connexis 131 Chapter 5 Establishing Connections Use of Invokes Invokes in Rose RealTime are the equivalent of synchronous messages. Remember that the normal method of communication in a Rose RealTime model is through asynchronous message sends. In contrast, invokes are very similar to regular function calls on objects in a system. The issue that can arise with invokes is that they bypass the normal message queuing structure that is in place in Rose RealTime. The calling capsule is blocked until the receiving capsule completes the transition code that has been called and returns. In addition, the receiving capsule must know to reply to the invoke. Rose RealTime invokes cannot be used across thread or processor boundaries. This means that if invokes are used in a particular situation, you will not be able to separate the two capsules involved in that connection into separate threads or processes without changes to the code. Since Connexis is used specifically to send inter-process messages, invokes cannot be used with Connexis-enabled connections. Use of Broadcast Sends A broadcast send is a send that is performed on a replicated port without specifying an index. Broadcast sends result in a message being sent to each of the capsules that are connected on the other side of the port. There are many cases where broadcast sends are a useful and appropriate technique. For example, when initializing capsules in an application, it may be necessary to send all of the capsules of a particular class an initialize message. If the order of the initialize messages is not important, a broadcast send may be used. The consequences of using a broadcast send are performance-related. A broadcast send on a port that has a multiplicity of n results in n individual message sends. This can impose a significant amount of overhead on your system, especially in cases where n is large and the messages are sent between processes. 132 User Guide - Rational Rose RealTime Connexis Connection Design Heuristics Use of Notification Notification is used to instruct the run-time libraries to send a message on a port whenever the port has been connected or disconnected from its peer on the other side of the connection. The rtBound message is sent when a connection is established and the rtUnbound message is sent when a connection is removed. In general the use of notification simplifies the job of the developer. There is one rule that must be followed when notification is being used on a port: when you deregister the port, and plan to register it again later, you must wait to receive the rtUnbound event before reregistering the port. This is required because the priority of the rtBound message is higher than that of the rtUnbound message. This means that if you deregister a port and then immediately register it again, the rtBound message could arrive first followed by an rtUnbound message. This could result in an unexpected message or it could cause the capsule to go into an incorrect state. Use of Defers Message deferral is a Rose RealTime feature that allows you to defer messages that are received when a capsule’s state machine is not ready to process them. Messages that have been deferred can be recalled at a later time for processing. Although message deferral is a useful, and in some cases, a necessary design technique, it does complicate the state machine design of your model. For this reason, defers should be used judiciously in Rose RealTime models. In some cases, defers are used to get around the asynchronous implementation of a part of the design that is logically sequential. For example, if you are starting a service by asynchronously requesting an object from an object factory, you may receive messages destined for the new object before it has been created and returned by the object factory. There are two solutions to this problem. The first is to defer the incoming messages. The second is to request the object synchronously using an invoke. User Guide - Rational Rose RealTime Connexis 133 Chapter 5 Establishing Connections Both of these solutions have trade-offs to consider. If you go the defer route, the state machine of the capsule becomes more complicated. There is also a greater probability of maintenance problems because state machine changes may require additional recalls to be placed in the code. If this is not done properly, errors may be introduced into the model. With the invoke solution, an entirely different set of issues results. There are no longer any message order issues, and the state machine is typically cleaner, but the connector that the invoke is being called on is required to remain in the same thread. Sending Data There are many performance issues to consider when sending data between capsules. The first thing to keep in mind is the relative performance of different kinds of message sends. In general, the types of message sends can be listed in order of relative performance (from fastest to slowest) as in the following list: 1. intra-thread 2. inter-thread 3. inter-process (same node) 4. inter-process (over network) In addition, messages with little or no data associated with them are typically faster than messages with a large payload. This would lead you to believe that it is better to send small messages between capsules, especially when the messages are sent between processes. This is true in general but the decision is a little more complicated than that. The other factor that comes into play is the frequency of the messages that are being sent. If you are sending small pieces of data between two capsules hundreds of times a second, it would typically be faster to buffer this data on the sending side and send a few larger messages. These are some of the decisions that must be made when designing a distributed application. Sending Data Classes by Value In order to send a data class by value across processes, it must be marshallable. Refer to the “Data Classes that are Marshallable” in the Rational Rose RealTime C++ Guide. 134 User Guide - Rational Rose RealTime Connexis Chapter 6 Using the Connexis Locator Service The Connexis Locator Service fulfills the role of the name server in a Connexis application. The Locator does not have to be configured or used in a Connexis application, but depending on the application’s requirements, it can be very convenient. The Connexis Locator Service supports both a primary and a backup locator. In this way, a distributed application can be made more robust by ensuring that the name server is not a single point of failure. By using the Locator, the location of endpoints to which an application is sending messages can remain totally transparent to the application. The application uses service names to refer to the endpoints that are being connected. The physical address of these endpoints never has to be revealed to the application. This makes creating a network topology that can be dynamically changed without affecting currently executing software, much easier than if physical endpoints are used. This strategy also allows load sharing topologies to be created much more easily than if physical endpoints are used. This chapter discusses: ■ Adding Locator Support to a Model - describes the capsule roles required to add Locator service. ■ Publication and Subscription - describes how the Locator handles publishers and subscribers. It provides information about ranking published ports and load-sharing publishers. User Guide - Rational Rose RealTime Connexis 135 Chapter 6 Using the Connexis Locator Service ■ Locator Dynamics - describes how the Locator operates when a publisher becomes fully subsribed, a subscriber loses its connection to a publisher, the primary Locator fails, or a subscriber is unconnected. It also discusses Locator race conditions. ■ Locator Configuration - describes the Locator configuration parameters and provides examples of how to start your application using a primary locator and backup locator. ■ Creating your Own Name Service - provides guidelines on using a custom name service in place of the Connexis Locator. Adding Locator Support to a Model To add the Locator to your application you must add a capsule role for either the RTDBase_Locator or the RTDBase_Locator_Agent capsules to a capsule in your application. Each node that is going to have a Locator configured to run with it (either backup or primary) must have one of these capsule roles contained in it (see “Sharing DCS Interfaces” on page 84). The RTDBase_Locator capsule only adds support for the Locator (primary or backup). The RTDBase_Locator_Agent adds support for both the Locator and for the Target Agent which is needed to run the Connexis Viewer. Publication and Subscription In Connexis, one endpoint in every distributed connection is the publisher and the other is the subscriber. The publisher posts (or publishes) its interface, making it available for another endpoint to connect to it. The subscriber connects to an endpoint that has been published. This pattern can be used to implement any kind of distributed connection topology. For example, client/server, peer to peer, etc. Publication A port is published with the locator by providing its service name and the endpoints where it can be reached. Multiple ports can be published with the same server name from the same endpoint, or different endpoints. 136 User Guide - Rational Rose RealTime Connexis Publication and Subscription The registerSPP() port function is used to publish a port. Deregistration of a published port (using the port’s deregisterSPP() function) causes it to be unpublished from the locator and severs any connections that are using that port. Subscription A port subscribes to the locator by providing its endpoint and the name of the service to which it wants to connect. If no port has previously been published with that service name, the subscription remains pending. Once one or more ports are published with that service name, the Locator returns the publisher with the highest rank using the preferred protocol, to the subscriber endpoint. If the subscriber has specified a protocol (locator_transport), the highest-ranked publisher which supports that protocol is returned. The DCS then makes an explicit registration on behalf of the subscriber port with the returned publisher. The registerSAP() port function is used to subscribe a port to a service. Ranking Published Ports The Locator supports the ranking of publishers. The default ranking of published ports is dependent on the following factors: ■ the rank that the publisher is given ■ the protocol that the publisher is using The rank of a publisher is specified by the designer through the use of a registration parameter. For example: .registerSPP(“dcs:/service1 ((locator_rank, 1))”); User Guide - Rational Rose RealTime Connexis 137 Chapter 6 Using the Connexis Locator Service When the locator searches for an endpoint to return, it follows this algorithm. If a subscriber has specified a preferred transport, using the locator-transport parameter when the SAP is registered, the locator returns an endpoint published on that transport. If the subscriber has not specified a preferred transport, but the locator has been started with the -CNXlpt= command line argument, it will return an endpoint published on the transport specified. This is the case if a publisher exists and if the subscriber has the transport available. If no endpoint has been found, the locator returns the first endpoint published on any transport the client has available. There is no default preferred transport version 2001.03.00 of Connexis. In all cases, the locator respects the rank, if any, that the publisher specified using the locator-rank registration parameter. The highest ranking endpoint will always be returned. The selection of an endpoint from among many of the highest rank is arbitrary. The default rank is zero. Load-sharing of Publishers Publishers of equal rank are load-shared among subscribers using a simple round-robin algorithm. As the publishers are load-shared, the assignment of a publisher to a subscriber is non-deterministic. Examples Ports publish themselves using the registerSPP() function call on an unwired end port and subscribe to a published port using the registerSAP() function call on an unwired end port. This section presents several examples of registration strings that could be used with these functions to publish or subscribe to interfaces using the Locator service. Example 1: Basic Locator registration Publish: .registerSPP(“dcs:/service1”); Subscribe: .registerSAP(“dcs:/service1”); 138 User Guide - Rational Rose RealTime Connexis Publication and Subscription Example 2: Locator registration using custom ranking Publish: .registerSPP(“dcs:/service1((locator_rank, 1))”); Subscribe: This parameter only applies to the publish side of a connection. Example 3: Specifying the protocol .registerSAP(“dcs:/service1((locator_transport, crm))”); Notice that in the simple cases (where a custom ranking or protocol is not being used), the registration string for both the publisher and the subscriber is the same and neither side of the connection has any knowledge of the value of the other side’s physical endpoint address. If a subscriber is registered using the Locator (registerSAP(“dcs:/service1”)) and no Locator is available (meaning the application was not launched with a -CNXlp or -CNXlpep parameter), then the registration will fail. If the same scenario exists for a publisher, the port will still be registered with the DCS and will be able to accept local and explicit connections. User Guide - Rational Rose RealTime Connexis 139 Chapter 6 Using the Connexis Locator Service Locator Dynamics Figure 63 is a sequence diagram that illustrates the basic publication and subscription operations of a Locator. Figure 63 140 Basic publication and subscription User Guide - Rational Rose RealTime Connexis Locator Dynamics From the user application perspective, the publication and subscription is accomplished through the registerSPP() and registerSAP() function calls on the port objects. The rest of the messages shown on the sequence diagram in Figure 63 are internal messages that occur as the result of a registerSAP() or registerSPP() function call. The Locator can be configured to execute on any node in the distributed application. This configuration is accomplished through command line parameters that are discussed later in this section. Fully Subscribed Publishers When a publisher becomes fully subscribed (meaning that all of the ports on the publisher have been subscribed to), the publisher unpublishes itself from the locator. At a later time, if a subscriber deregisters itself from that publisher, the publisher republishes itself with the locator. This sequence of events is illustrated in the sequence diagram shown in Figure 64. Figure 64 Fully subscribed publishers User Guide - Rational Rose RealTime Connexis 141 Chapter 6 Using the Connexis Locator Service Subscriber Losing Connection to a Publisher If a subscriber that has successfully connected to a published endpoint later loses that connection (through deregistration of the publisher, failure of the publisher’s host, etc.), and this is detected by the underlying transport, then the subscriber port is automatically resubscribed to the locator. If the underlying transport does not provide this quality of service, then it is up to the user application to implement a failure detection mechanism in the protocol to detect messaging failures and reregister as necessary. One possible solution to this problem is to set up a timer on the subscriber that periodically sends a message to the publisher. If the publisher does not respond to this message within a specified amount of time, the subscriber resubscribes to the service. Locator Failure If the primary Locator has been configured with a backup, and the primary Locator goes down, the backup Locator automatically takes over the role of primary Locator. When this primary/backup strategy is used, the primary and backup Locators should be placed on different nodes in the network. This ensures that there is not a single point of failure in your distributed application. Figure 65 illustrates the basic fail-over scenario of a primary/backup Locator. The backup continually polls the primary, and restarts the election protocol should the primary fail to respond. The backup assumes the role of the primary when the primary continues to fail to respond to the election protocol. When the backup takes over, it broadcasts a message to all endpoints stating that it is now the primary locator. The endpoints acknowledge this and republish all global publisher ports and pending subscription ports with the newly elected primary Locator. Should the original primary locator become available again, it assumes the role of the backup locator. During the time that it takes for the transition from primary to backup locator to take place, new publish or subscribe requests will be delayed until the backup locator takes over. 142 User Guide - Rational Rose RealTime Connexis Locator Dynamics Figure 65 Primary to backup switchover User Guide - Rational Rose RealTime Connexis 143 Chapter 6 Using the Connexis Locator Service Locator Race Condition There may be cases where the publisher becomes unavailable in between the time that its endpoint is received from the locator and the time when the explicit registration is attempted. One scenario that would cause this to happen is illustrated in the sequence diagram in Figure 66. Figure 66 Locator race condition In this case, subscriber2 got the endpoint from the locator and bound to the last available port on the publisher. Meanwhile, subscriber1 got the endpoint from the locator (before the publisher had unpublished with the locator), and attempted to bind to it. This bind fails because there are no ports left on the publisher. This scenario causes subscriber1 to resubscribe with the Locator. 144 User Guide - Rational Rose RealTime Connexis Locator Configuration Unconnected Subscribers If no unbound publishers are available, the subscriber remains pending at the locator forever. Deregistration of a subscriber port that has a pending subscription causes it to be unsubscribed from the Locator. Locator Configuration The Locator service is an optional service that provides subscribers with an endpoint that will be used on a first-come, first-served basis when trying to connect to a publisher. The Locator service can be initialized with both a primary and a backup server. The initial Connexis release only supports a single backup server. This limits the level of fault-tolerance to a single processor failure. This is not a fundamental restriction of the primary/backup approach and support for multiple backup servers may be added in future releases. It is possible to operate with a single Locator for test purposes or if fault-tolerance is not required in the product. Locator Parameters There are several configuration options that can be used to set up the Locator for specific environments. These are listed in Table 14. Table 14 Locator command line options Command Line Option Description CNXlocator_primary (CNXlp) Specifies that this process should be made the primary locator. Argument Type: none Default Value: none CNXlocator_backup (CNXlb) Specifies that this process should be made the backup locator. Argument Type: none Default Value: none User Guide - Rational Rose RealTime Connexis 145 Chapter 6 Using the Connexis Locator Service Table 14 Locator command line options Command Line Option Description CNXlocator_primary_ endpoint (CNXlpep) Specifies the endpoint of the primary locator (if this process is not the primary locator). Argument Type: string Default Value: none CNXlocator_backup_ endpoint (CNXlbep) Specifies the endpoint of the backup locator (if this process is not the backup locator). Argument Type: string Default Value: none CNXlocator_retry_delay (CNXlrd) Specifies the amount of time, in ms, to wait before retries. The value must be >50. Argument Type: integer Default Value: 2000 CNXlocator_audit_delay (CNXlad) Specifies the amount of time, in ms, to wait between audits of the primary and backup locators. The value must be >50. Argument Type: integer Default Value: 2000 CNXlocator_audits_oos (CNXlao) Specifies the number of failed audits required to take the primary locator out of service. Using the default of 3, the primary locator would be taken out of service after the third consecutive audit had failed. Argument Type: integer Default Value: 3 CNXlocator_preferred_ transport (CNXlpt) Specifies that the first protocol to be chosen. This option can only be set at the primary or backup locators. Argument Type: string Default Value: none 146 User Guide - Rational Rose RealTime Connexis Locator Configuration A locator is configured as the primary by starting the application with the -CNXlp command line option. When the locator starts up it publishes a port with the DCS. The backup locator will later connect to this port for the purpose of monitoring the primary locator. If the primary locator fails, future locator requests will be routed directly to the backup locator. If a backup is present, the CNXlbep option must also be specified when the primary is started so that collocated clients can use the locator if the backup takes over. A locator is configured as the backup by informing the Connexis library that the application is acting as the backup locator and by specifying the explicit endpoint of the primary locator. This is done using the -CNXlb command line option (to specify that this application is the backup locator) and the -CNXlpep command line option (to inform Connexis of the address of the primary locator). The backup locator subscribes to the port that is published by the primary locator. The backup uses this port to periodically poll the primary locator. If the primary fails to respond to the polling messages, the backup bids to takeover as the primary. Client Connexis applications in this fault-tolerant configuration must be configured with the endpoints of both the primary and the backup. Each Connexis client explicitly subscribes to a port on both the primary and the backup locators. Registrations are only sent to the locator which has identified itself as the primary. Figure 15 outlines the common Locator configurations and the parameter combinations that are required to support them. User Guide - Rational Rose RealTime Connexis 147 Chapter 6 Using the Connexis Locator Service Table 15 Common Locator configurations and required parameters Configuration Required Options Description When starting a client that is collocated with the primary locator and no backup is being used. CNXlp The CNXlp option is required to establish the process as the primary locator. When starting a client that is collocated with the primary locator and a backup is being used. CNXlp, CNXlbep The CNXlp option is required to establish the process as the primary locator. The CNXlbep options is required so that the primary locator and the client know about the backup. When starting a client that is collocated with the backup. CNXlb, CNXlpep The CNXlb option is required to establish the process as the backup locator. The CNXlpep option is required to inform the backup and the client of the primary locator. When starting a client that is using a primary locator with no backup. CNXlpep The CNXlpep option is required to inform the client of the location of the primary locator. When starting a client that is using a primary locator with a backup. CNXlpep, CNXlbep The CNXlpep and CNXlbep options are required to inform the client of the location of the primary and the backup locators respectively. 148 User Guide - Rational Rose RealTime Connexis Locator Configuration Locator Parameter Examples This section presents several examples of starting different components that are part of a distributed application that is using the Connexis Locator service. Example 1: Two node application with no backup locator To start the application that acts as the primary locator: -CNXep=cdm://host1:9999 -CNXlp The other application is started using the following command line syntax: -CNXep=cdm://host2:9991 -CNXlpep=cdm://host1:9999 Example 2: Three node application with primary and backup locator To start the application that acts as the primary locator: -CNXep=cdm://host2:9999 -CNXlp CNXlbep=cdm://host3:9999 To start the application that will be acting as the backup locator: -CNXep=cdm://host3:9999 -CNXlb CNXlpep=cdm://host2:9999 To start the other application: -CNXep=cdm://host2:9991 -CNXlpep=cdm://host2:9999 CNXlbep=cdm://host3:9999 User Guide - Rational Rose RealTime Connexis 149 Chapter 6 Using the Connexis Locator Service Creating your Own Name Service The Locator service that is provided with Connexis is designed in a very general fashion. It should satisfy most of the requirements for this type of service, but there may be cases where a different level of functionality is required by a specific application. In these cases, it may be desirable to design and use your own name service instead of using the Connexis Locator. If you do this, there are several key differences between the Connexis Locator and a simple name service that you should be aware of. The Connexis Locator does more than simply translate a supplied service name into a physical endpoint. The Connexis Locator also provides the following features: ■ allows for arbitration between several identically named publishers ■ performs prioritized endpoint lookup on these publishers based on rank and protocol priority ■ allows pending subscriptions which are automatically connected to publishers that are registered at a later time ■ provides automatic re-subscription when publishers fail ■ provides a fault-tolerant (no single point of failure) name service ■ provides load-sharing of multiple publishers A simple name service will typically only do a one-to-one mapping between an endpoint service name and the endpoint physical address. If your application does not require the additional features provided by the Connexis Locator, you may want to create a custom name service. An example, where this may be desirable, is if all of the nodes in your distributed application can be determined by some kind of algorithmic mapping of a service name (for example, “tributaryPort03”) to an explicit endpoint. Another example, where this may be desirable, is in a static network environment where all of the endpoint mappings could be read from a configuration file at system start-up time. In either of these cases, a Connexis connection could be used by all of the nodes in the distributed application to connect to a known “nameservice” port. This “nameservice” port returns an explicit endpoint given a service name that was passed in to it. 150 User Guide - Rational Rose RealTime Connexis Chapter 7 Using the Connexis Viewer Debugging the data flow between embedded component instances in a distributed network can be a very difficult task. For distributed systems that have been designed and generated using Rational Rose RealTime and Rational Connexis, the Connexis Viewer can be used to provide real-time insight and feedback to aid in the debugging process. The Connexis Viewer consists of a workstation component that is provided for user interaction. The workstation component is launched from within a Rose RealTime session and consists of a target agent which monitors the DCS port registration process and collects trace events. The Connexis Viewer provides the following information about an executing model: ■ the status of unwired end ports that are registered with the DCS ■ an indication of which DCS unwired end ports are bound to eachother ■ traces of user data sent from or received at a DCS registered port ■ traces of DCS Locator and DCS Transport events ❑ transport connection establishment and failure ❑ DCS locator switchover ❑ synchronization of naming tables between the active and the standby DCS locators User Guide - Rational Rose RealTime Connexis 151 Chapter 7 Using the Connexis Viewer The circuit tracing functionality provided with the Connexis Viewer offers features that are similar to the Rose RealTime’s Target Observability with the following exceptions: ■ Traces can be enabled and controlled independently of the Rose RealTime toolset. ■ The output of trace information is handled on a separate (low priority) thread and is minimally intrusive to the running application. Note: The Connexis Viewer can be used at the same time as Rose RealTime’s Target Observability feature. In fact, the easiest way to start viewing a distributed model is to launch the different applications directly from Rose RealTime. The metrics collecting functionality provided with the Connexis Viewer lets you control and view the metrics collection results of a component instance. It provides the following features: 152 ■ Controls start and stop function for metrics collection ■ Displays metrics data for any registered transports ■ Displays aggregate data for all registered transports ■ Displays controller metrics ■ Saves data in a format that allows for further analysis User Guide - Rational Rose RealTime Connexis Viewer Architecture Viewer Architecture The Viewer communicates with the executing model through the Target Agent as shown in Figure 67. The Target Agent component must be contained in every Rose RealTime executable to which the Viewer connects. The Target Agent operates on a low priority thread and relays information about the executing model back to the Viewer where it can be seen. Figure 67 High-level architecture Adding Viewer Support to a Model To add Viewer support to your application, you must add a capsule role from the RTDBase_Agent or the RTDBase_Locator_Agent capsule, to a capsule in your application. Each node requiring Viewer support, must have one of these capsule roles contained in it. The RTDBase_Agent capsule only adds support for the Target Agent, which is needed to run the Connexis Viewer. The RTDBase_Locator_Agent adds support for both the Target Agent and the Locator. For more information on Connexis-enabling a Rose RealTime application refer to “Adding Connexis Support to Your Model” on page 83. User Guide - Rational Rose RealTime Connexis 153 Chapter 7 Using the Connexis Viewer Before starting the Viewer, there are two command line options that you should specify for your Rose RealTime component instances: ■ CNXep - Used to specify the Connexis endpoint. The Viewer must know the Connexis endpoint of the executing model to be able to connect to the running application. This is a required parameter. ■ CNXui - Used to specify a unique identifier for the endpoint. If this option is not specified, Connexis assigns a default identifier for the endpoint. The default is a hex code and does not easily identify the endpoint in the Viewer. For this reason, it is recommended that you define your own unique, descriptive identifier. If the CNXep option is not specified on the component instance (in Rose RealTime), you can specify it using the Viewer. The CNXui option can only be modified in the Viewer on user-defined component instances. This means that if the component instance was read in from Rose RealTime, you cannot modify it in the Viewer. Adding Metrics Support to a Model Like tracing, metrics gathering is done on the target itself and is reported to the Viewer. This capability is enabled by default in the DCS libraries that ship with Connexis, but it can be enabled or disabled when the DCS library is recompiled by the user. Like tracing, the model must contain either the RTDBase_Agent or the RTDBase_Locator_Agent capsule. When the Viewer connects to the Target Agent in the component instance, it asks if metrics gathering is enabled on the target. If it is not, a warning message is displayed in the log of the viewer and no metrics reporting can be done. 154 User Guide - Rational Rose RealTime Connexis Starting the Connexis Viewer Starting the Connexis Viewer You can start the Connexis Viewer from the Rose RealTime main menu, from a deployment diagram or from a deployment package. To start the Connexis Viewer from the main menu: 1. Open the Connexis-enabled Rose RealTime model that you want to view. 2. Select Tools > Connexis Viewer. If you have a deployment diagram active when you start the Viewer, it uses the processor and component instances from that diagram. If no deployment diagram is active, it uses the processors and component instances in the model. To start the Connexis Viewer from a deployment diagram or a deployment diagram icon: 1. Right-click the deployment diagram or the deployment diagram icon. A popup menu appears. 2. Select Connexis Viewer from the popup menu. The Connexis Viewer appears. The Connexis Viewer uses the processor and component instances from the deployment diagram icon that you have selected. To start the Connexis Viewer from a deployment package: 1. Right-click the deployment package. A popup menu appears. 2. Select Connexis Viewer for the popup menu. The Connexis Viewer appears. The Connexis Viewer uses the processor and component instances from the deployment package. User Guide - Rational Rose RealTime Connexis 155 Chapter 7 Using the Connexis Viewer Duplicate CNX Unique Identifiers The Duplicate CNXui dialog box indicates that there are multiple component instances that use the same CNXui. This may cause confusing information to be displayed when using Connexis Viewer features that rely on the CNXui. When this occurs, operations that involve displaying information about the remote end of a connection may not function correctly. The recommendation is that CNX unique identifiers be unique amongst all component instances in the Connexis Viewer session. Figure 68 Duplicate CNXuis dialog box Viewer Main Window The Viewer main window contains the following: 156 ■ Main menu - is used to access application-specific operations ■ Tree view - is the main interface to the user and is used to display and configure information about the executing application as well as to open trace windows ■ Trace pane - is used to manage all of the trace windows that are currently open User Guide - Rational Rose RealTime Connexis Viewer Main Window ■ Log window - is used to log connection information ■ Status bar - is used to display information about the state of the application Figure 69 shows the Viewer main window with the HelloWorld model being viewed. Figure 69 The Viewer main window User Guide - Rational Rose RealTime Connexis 157 Chapter 7 Using the Connexis Viewer Viewer Menus The main menu, as shown in Figure 70, consists of a File, View, Tools, Window and Help menu. Figure 70 Connexis Viewer Main menu File Menu Import Selecting File > Import displays a standard open dialog box that allows you to import a previously-saved Viewer configuration file. Use the Import command when you want to view a model in addition to the one against which you launched the Connexis Viewer. The result of importing the other model's information is the same as manually adding each of the model's Processor and component instance definitions. Note: Before you import, you must generate the .CVMInfo file for the model to be imported. This file is generated automatically when you use the Connexis Viewer with a model. Exit Selecting File > Exit exits the application. View Menu Status bar The View menu allows you to toggle the visibility of the Status Bar. A check mark appears beside the menu item when it is visible. 158 User Guide - Rational Rose RealTime Connexis Viewer Menus Tools Menu Options Selecting Tools > Options displays a “Preferences” dialog (see Figure 71) that lets you select Session defaults, Component Instance defaults and Tracing defaults for the Connexis Viewer (see Table 16, “Preference dialog settings,” on page 160). Figure 71 Preferences dialog . User Guide - Rational Rose RealTime Connexis 159 Chapter 7 Using the Connexis Viewer Table 16 Preference dialog settings Option Description Check for duplicate CUIDs Checking this field lets Connexis identify, on startup, any duplicate CUIDs in a model. This occurs if you have the same logical CUID value (specified using the 'CNXui' parameter) for components that are being deployed on different configurations. Connect to target agents on load Checking this box lets all new Component Instances connect to target agents. Auto-expand Tree Checking this box lets all new Component Instances function with the Auto-expand tree feature. Connection Timeout Typing the number of seconds in this field sets the timeout period for all new Component Instances. 160 Refresh Mode Refresh Mode lets you select the way component instances are refreshed (Auto, Manual or Timed). For the Viewer to refresh component instances automatically, select “Auto” from the list. Select “Manual” if you want to refresh the component instance manually or select “Timed” and set your desired refresh period in seconds. Trace Limit Setting the value of this field determines the initial size of the tracing buffer. This specifies the number of trace events stored for all trace windows, including Component Instances, Ports and Circuit traces. Circuit Trace Level Selecting the level from this list determines the initial setting (Disabled, Activity, Signal or Signal and Data) for Port and Circuit tracing. When you open a trace window onto a Publisher, Subscriber or Circuit without performing a 'Define...,' the default trace level is the one defined in this field. User Guide - Rational Rose RealTime Connexis Viewer Menus Windows Menu Tile Selecting Window > Tile causes all non-iconified Trace windows to be arranged in a format in which the trace windows do not overlap. Cascade Selecting Window > Cascade causes all non-iconified Trace windows to be arranged in a 'stack' which allows the captions of each window to be visible. Trace Windows List Selecting one of the entries in the Trace Windows List (the numbered entries) causes that window to become the active Trace Window. The window is brought to the top, and if it had been previously iconified, it is restored to its normal state. Help Menu Contents Selecting Help > Contents... launches the main help for Connexis and the Viewer. About Connexis Viewer Selecting Help > About Connexis Viewer, displays the Viewer’s about dialog. The about dialog contains information about the version of the Connexis Viewer that is being used and also contains information about how to contact Connexis support. User Guide - Rational Rose RealTime Connexis 161 Chapter 7 Using the Connexis Viewer Explorer Tree View The primary way of configuring a Viewer session is through the tree view. Most of the objects on the tree view have popup menus that allow you to configure the object and to control the information that is displayed for the object when the application is executing. Figure 72 shows the tree view while the HelloWorld model is executing. Every item in the tree view belongs to the session. The session contains zero or more processors. Processors contain zero or more component instances. Component instances contain zero or more named services. Named services contain zero or more registered end ports and registered end ports contain zero or more virtual circuit endpoints. The processor and component instance information can be derived directly from a Rose RealTime model. The Viewer captures the information that is contained in the deployment view of the model that was open when the Viewer was launched. Additionally, you can add processors and component instances manually inside the Viewer. This is useful if you also want to monitor Connexis-enabled Rose RealTime executables that are not contained in the model from which the Viewer was launched. Figure 72 162 The Explorer tree view User Guide - Rational Rose RealTime Connexis Explorer Tree View Processor Icons Processors that have been added automatically by launching the Viewer are illustrated using the same processor icon as is used in Rose RealTime (see the ClientProcessor_VC60@127.0.0.1 processor in Figure 72 and Table 17). Processors that are added manually in the Viewer are illustrated using the processor icon with a downward pointing arrow inside (see the Workstation1@127.0.0.1 processor in Figure 72 and Table 17). Processors that are added manually will be reloaded the next time the Viewer is opened from the same model. Table 17 Processor icons Icons Meaning automatically-added processor manually-added processor Component Instance Icons Component instances, that have been added automatically by launching the Viewer, are illustrated using the same component instance icon as is used in Rose RealTime (refer to the Client_VC60Instance (10010) component instance in Figure 72). Component instances that are added manually are illustrated using the component instance icon with a downward pointing arrow inside (refer to the TestComponentInstance (9999) component instance in Figure 72). Component instances that are added manually will be reloaded the next time the Viewer is opened from the same model. Table 18 Component instance icons Icons Meaning automatically-added component instances manually-added component instances User Guide - Rational Rose RealTime Connexis 163 Chapter 7 Using the Connexis Viewer Filter Icons A Filter icon lets you add, select or remove a trace filter specification from the Explorer tree view. Clicking the plus symbol to the left of the Filter icon expands the tree and reveals the trace filter specifications that are available for use. If there are no trace filter specifications available, right-clicking the Filter icon lets you add a new trace filter specification. (see“Defining a Trace Filter for a Component Instance” on page 182). Figure 73 Filter Icon Component Instance Status Component instance status is indicated in the tree view by varying the gear icon shown in Figure 74. Figure 74 Gear icon When a target agent connection is established, the tree refresh mode (that is, manual, automatic, or timed) is reflected through the gear spin. Feedback is summarized in Table 19. Table 19 Gear spin and status Icon behavior Meaning green, continuous spinning Automatic refresh mode green, intermittent spinning Timed refresh mode green, with no spin Manual refresh mode When the Viewer has lost contact with the target (red), is manually disconnected (gray), or is connecting (yellow), there is no feedback for the refresh mode (since there is no active refresh in these states). 164 User Guide - Rational Rose RealTime Connexis Explorer Tree View Table 20 Gear color and status Icon appearance Meaning No Gears The Target Agent has not been connected to this component instance in this Viewer session. Yellow Gears The user has requested a connection to the Target Agent but the connection has not yet been established. Green Gears The Target Agent is connected to the component instance. If the component instance is in Auto Refresh mode, the gears will be spinning. (See Table 19) Red Gears The Viewer has determined that it has lost the connection with the Target Agent. This is most likely an indication that the component instance has stopped running or is hung. The Viewer maintains the last known state in the tree until the component instance is Reset. Gray Gears There is currently no connection established between the component instance and the Target Agent. Named Services Icons Named services appear in the tree view as folders (see Figure 75) that are contained in component instances. Named services are identified using the name that they were registered as with the DCS. Inside each named service are zero or more registered end ports. The registered end ports are referred to by the names that they were given in the Rose RealTime model (this may or may not be the same as the name that they were registered as), followed by the Rose RealTime model path to the end port, the number of the end port instance, and the total number of instances. Figure 75 Named service icon Port Icons Publisher ports appear in the tree view with a red port icon beside them (refer to the EnglishServer:greeting(1/1) port in Figure 72 and Table 21). Subscriber ports appear with a yellow port icon if the port is not bound, or a green port icon if the port is bound. User Guide - Rational Rose RealTime Connexis 165 Chapter 7 Using the Connexis Viewer Table 21 Port icons Icons Meaning Publisher port icon Subscriber port icon Virtual Circuit Icons The last items that appear on the left hand side of the tree view are the virtual circuits. Virtual circuits are contained inside of end port objects in the tree view and appear with a green protocol icon beside them (refer to (Client, 2) --> (Server1, 2) “EnglishServer:greeting” in Figure 72 and Figure 76). Figure 76 Virtual circuit icon Virtual circuits represent the Connexis connections that are currently established in the running model as of the last time the Viewer was refreshed. The information that is displayed in the tree view about a virtual connection contains the following: ■ the unique identifier for the local component instance followed by the virtual circuit ID for that side of the connection ■ the unique identifier for the remote component instance followed by the virtual circuit ID for that side of the connection ■ the name and Rose RealTime model path of the end port on the other side of the connection enclosed in quotation marks The virtual circuit illustrates why it is important to specify the CNXui command line option on your component instances. If usable identifiers had not been used in this model, the Client and Server1 identifiers would have appeared as numbers that were generated by Connexis. 166 User Guide - Rational Rose RealTime Connexis Explorer Tree View This would have caused the information for the virtual circuit contained in the EnglishServer:greeting (1/1) end port in Figure 72 to be something similar to the following: (76f95d83,2) --> (76f98e45,2) “Client:greeting” This information is much more difficult to keep track of when you are viewing an executing model. Object Information Column The Object Information column is on the right-hand side of the tree view and is shown in Figure 77. It is used to display additional information about each of the objects in the tree view. Figure 77 The Object Information column Table 22 explains what information is displayed in the Object Information column for each object type. User Guide - Rational Rose RealTime Connexis 167 Chapter 7 Using the Connexis Viewer Table 22 Object Information description Object type Information displayed Processor Operating system and hardware architecture. Component Instance Connexis Unique Identifier. This displays the string that was specified using the CNXui command line option. If the user did not specify an identifier, the Connexisgenerated identifier is not displayed until you connect to that component instance. This field also displays the locator configuration and status. Named service Number of publishers and subscribers that are currently registered, and in the case of publishers, the sum of the replication factors of the named service for the component instance. Registered end port The Connexis Registration string that was used to register the port. Virtual circuit This field indicates which transport protocol is used to establish the connection. This field also indicates the type of connection that has been established by Connexis. Popup Menus Most operations in the Connexis Viewer are performed by selecting an element and using the popup menu. Clicking the right mouse button on an element in the Explorer Tree View enables you to perform operations such as adding a processor or component instance, defining trace parameters, opening a trace window, and so on. Session Popup Menu The session object in the tree view has a popup menu associated with it. This menu is shown in Figure 78. The only option available from this menu is to add a new processor to the session. 168 User Guide - Rational Rose RealTime Connexis Popup Menus Figure 78 The session popup menu Add Processor The Add Processor command allows you to add a processor to the tree view. See also “Adding a Processor” on page 175. Processor Popup Menu All processors in the tree view have a popup menu associated with them as shown in Figure 79. Figure 79 The processor popup menu Open Specification The Open Specification command allows you to modify a processor’s properties. See also “Changing the Properties of a Processor” on page 176. User Guide - Rational Rose RealTime Connexis 169 Chapter 7 Using the Connexis Viewer Remove The Remove command allows you to remove a processor that you have manually added to the model. This command appears grayed out if the processor was read in from a Rose RealTime model. Add Component Instance The Add Component Instance command allows you to add a new component instance to the tree view. See also “Adding a Component Instance” on page 177. Component Instance Popup Menu The component instance popup menu is context-sensitive and is shown in Figure 80. Slightly different options will appear in this menu depending on the state of the component instance. Figure 80 shows what is displayed if the menu is opened from a component instance that was read in from a Rose RealTime model and where the Target Agent has been started on the component during the active session. Figure 80 170 The component instance popup menu User Guide - Rational Rose RealTime Connexis Popup Menus Open Specification The Open Specification command allows you to modify a component instance’s properties. See also “Changing the Properties of a Component Instance” on page 180. Remove The Remove command allows you to remove a component instance that you have manually added to the model. This command appears grayed out if the processor was read in from a Rose RealTime model. Connect to Target Agent on load The Connect to Target Agent on load command changes context depending on the current Target State as summarized in Table 23. Table 23 Connect to Target Agent Target State Command text Action Not Connected (Gray gears) Connect to Target Agent Attempts to connect to this component instance's Target Agent Waiting for Connection (Yellow gears) Cancel Target Agent Connection Cancels the attempt to connect Connected (Green gears) Disconnect from Target Agent Disconnects from the Target Agent Disconnected (Red gears) Reset Target Agent Connection Clears the tree information and returns to the “Not Connected” Target state Refresh The Refresh command allows you to manually refresh the information that is being displayed about the component instance and all of the objects under it in the tree view. This option is available even if the Timed or Auto refresh methods are selected for the component instance. See also “Changing the Properties of a Component Instance” on page 180. User Guide - Rational Rose RealTime Connexis 171 Chapter 7 Using the Connexis Viewer Apply Filter The Apply Filter command lets you select a previously-defined trace filter for a component instance. A popup menu appears, listing all available filters. Define Trace The Define Trace command allows you to define trace settings for a component instance. See also “Defining a Trace Filter for a Component Instance” on page 182. Open Trace Window The Open Trace Window command lets you open a trace window from a component instance. Once the trace window appears, you can rightclick on the window to define or apply a trace filter to the component instance (see “Trace Window Popup Menu” on page 196). Open Metrics Window The Open Metrics Window command opens a metrics window on the component instance. The Viewer does not have to be connected to the component instance, but the component instance must be running for the metrics connection to work. Reset Metrics The Reset Metrics command restarts the target metrics counter and resets the collection and reporting of metrics from the selected component instance. The component instance must be running for this menu item to be available. 172 User Guide - Rational Rose RealTime Connexis Popup Menus Port Reference Popup Menu The Port reference popup menu is shown in Figure 81. Figure 81 The Port Reference popup menu Define Trace The Define Trace command allows you to define trace settings for a port reference. See also “Defining a Port Reference Trace” on page 188. Open Trace Window The Open Trace Window command opens a trace window on the port reference. This trace window uses the filters that were defined in the Define Trace dialog. User Guide - Rational Rose RealTime Connexis 173 Chapter 7 Using the Connexis Viewer Virtual Circuit Popup Menu The Virtual circuit popup menu is shown in Figure 82. Figure 82 The virtual circuit popup menu Show other end The Show other end command allows you to highlight the virtual circuit endpoint that is at the other end of the connection. Define Trace The Define Trace command allows you to define trace levels for a virtual circuit. See also “Defining a Virtual Circuit Trace” on page 192. Open Trace Window The Open Trace Window menu item opens a trace window on the virtual circuit. This trace window will use the filters that were defined in the Define Trace dialog. 174 User Guide - Rational Rose RealTime Connexis Creating Processors and Component Instances Creating Processors and Component Instances The Connexis Viewer lets you create processors and component instances that are not part of the current model. This is useful when you wish to perform traces on distributed systems that are composed of several models. Using the Import command to import all information from another model may be undesirable depending on the size and complexity of the model. The ability to add processors and component instances from another model allows you to: ■ see information for a single component instance in a complex model without burdening your session with unnecessary information ■ perform a trace when the model for the other component instances is not available (for example, the model was developed off-site) New processor and component instances are stored in.CVEInfo file. Once defined, they will always appear when you open the model. Adding a Processor You can add a processor that is not part of the current model to the tree view. To add a processor: 1. Select New Session in the tree view. 2. Right-click and select Add Processor from the popup menu. The dialog shown in Figure 83 appears. Figure 83 Add Processor dialog User Guide - Rational Rose RealTime Connexis 175 Chapter 7 Using the Connexis Viewer 3. Enter a processor name. Note: Letters, numbers, and underscores are permitted in the name. Spaces are prohibited. 4. Enter the IP address of the processor. 5. Enter the CPU type. 6. Enter the operating system. 7. Click the OK button. If you need to modify a processor’s properties after you have created it, see “Changing the Properties of a Processor” on page 176. Changing the Properties of a Processor The Connexis Viewer allows you to edit a processor’s properties after you have created it. To change a processor’s properties: 1. Select the processor. 2. Right-click and select Open Specification from the popup menu. The dialog box shown in Figure 84 appears. Figure 84 Processor Specification dialog 3. Edit the fields as desired. 4. Click the OK button. 176 User Guide - Rational Rose RealTime Connexis Creating Processors and Component Instances Removing a Processor You can remove a processor that you manually added to the model from the Connexis Viewer. Processors that have been read in from a Rose RealTime model cannot be removed, and as a result, appear grayed out on the menu. To remove a processor: 1. Select the processor. 2. Right-click and select Remove from the popup menu. Adding a Component Instance You can add a component instance that is not part of the current model to the tree view. To add a component instance: 1. Select the processor to which you want to add a new component instance. 2. Right-click and select Add Component Instance from the popup menu. The dialog box shown in Figure 85 appears. User Guide - Rational Rose RealTime Connexis 177 Chapter 7 Using the Connexis Viewer Figure 85 Add Component Instance dialog 3. Enter a name for the component instance. Note: Letters, numbers, and underscores are permitted in the name. Spaces are prohibited. 4. Enter the CNX endpoint (CNXep). This must be a valid Connexis endpoint. Specifying just a port number translates into the endpoint cdm:// :portnumber where is obtained from the processor containing this component instance. 5. Enter the CNXui field if you created the component instance manually. Note: You cannot edit this field if the component instance was read in from a Rose RealTime model. 6. Click to enable Connect to Target Agent on load. When this option is enabled, the Viewer: 178 User Guide - Rational Rose RealTime Connexis Creating Processors and Component Instances ❑ attempts to connect to the component instance’s target agent on startup ❑ automatically attempts to reconnect to a Target Agent when it becomes 'Disconnected' (that is, unexpectedly loses its connection). This is useful in situations such as when the target is reset, rerun, or the communication link between the target and the Viewer is broken and re-established. All component instance trace filters established before the reset are maintained. If this option is not selected, the Target Agent must be started manually. 7. Click to enable Auto expand tree. When this option is enabled, the tree view is automatically expanded to show new objects underneath the component instance such as named services, publishers and subscribers, and connections. 8. Enter a Connection timeout value in seconds. This is the amount of time that the Viewer will wait for a reply from the target agent before it assumes the connection has been terminated. This value is used in two situations: ❑ When the Viewer attempts to attach to a target agent, the value in the connection timeout field is used to decide how long the Viewer waits for the target agent to handshake with the Viewer. If the handshake is not received within the specified interval, the target agent must be reset and another connection attempt must be initiated. A value of 0 indicates that the Viewer should wait forever. ❑ After the connection has been established (during normal communication), the value in the connection timeout field is used to determine how long the Viewer should wait for a response from the target agent. Once a request for information is sent by the Viewer to the target agent, the target agent is expected to reply within the time specified in the connection timeout field. The target agent is given three attempts to respond within this interval. If it does not, the Viewer sends it a status query. If no response is received for the status query within the connection timeout period, the connection is assumed to have timed out and the target agent must be reset and reconnected. If the connection timeout is set to 0, the default connection timeout period of 30 seconds is used. User Guide - Rational Rose RealTime Connexis 179 Chapter 7 Using the Connexis Viewer 9. Choose a Refresh mode from the drop-down list: ❑ Manual - All refreshes of the data that is displayed in the tree view must be done by selecting Refresh from the component instance’s popup menu. ❑ Auto - Refreshes the model in real-time. This causes the Viewer to refresh the display whenever a modification causes the information that is displayed in the Viewer to change. This operation may not be desirable for “highly active” models since a constantly-changing model will cause the tree display to fluctuate as it attempts to keep up-to-date. ❑ Timed - If this option is selected, the refresh will occur every n seconds where n is the value entered in the seconds field. 10. Enter the rate (milliseconds) at which you want metrics data to be reported to the Viewer, in the Preferred Rate text box. If the rate you request is more frequent than the rate at which the component instance audits its circuits, the rate you request will not be supported by the component instance. In such a case, metrics uses the auditing rate of the component instance. For example, if the component instance "Client" uses the default audit period of 250 ms, and you set the Preferred Rate to 100 ms, metrics will be reported at an audit period of 250 ms. Changing the Properties of a Component Instance The Connexis Viewer lets you edit a component instance’s properties after you have created it. To change a component instance’s properties: 1. Select the component instance you wish to modify. 2. Right-click and select Open Specification. The dialog box shown in Figure 86 appears. 180 User Guide - Rational Rose RealTime Connexis Creating Processors and Component Instances Figure 86 Component Instance Properties dialog 3. Edit the fields as desired. Note: You cannot edit the CNXep field if the component instance was read in from a Rose RealTime model. You can only edit this field if the component instance was created manually. 4. Click the OK button. User Guide - Rational Rose RealTime Connexis 181 Chapter 7 Using the Connexis Viewer Performing Event Tracing The Connexis Viewer lets you perform event tracing on component instances, port references and virtual circuits. The options available vary depending on the type of element selected for tracing and are described in detail in the following sections: ■ Defining a Trace Filter for a Component Instance ■ Defining a Port Reference Trace ■ Defining a Virtual Circuit Trace Defining a Trace Filter for a Component Instance Trace filters let you trace messages and event types from a distributed model. You can define a trace filter from a Component Instance icon or a Filter icon. Right-clicking either icon lets you access a dialog box that allows you to set the filter levels for different trace groups and trace types. The component instance trace levels that are available for the trace groups and trace types are: ■ Disabled - no tracing for the group/type ■ Basic - events that are related to the static operation of a group or type. This includes start-up events, connect events and shutdown events ■ Operational - events that are related to the dynamic behavior of a group. This is the trace level that is used to trace data transport ■ Advanced - enables all tracing for a group. This is typically very detailed and includes all events from the other trace levels as well as audit information Note: When setting the trace levels for the different types and groups, keep in mind that the more tracing being performed, the more data is being sent to the Viewer. This can have a negative impact on the performance of the executing model. To define a trace filter from a Component Instance icon: 1. Right-click the Component Instance icon that you want to trace. 2. Select Define Trace from the popup menu. The Set Component Instance Trace Levels dialog appears. 182 User Guide - Rational Rose RealTime Connexis Performing Event Tracing Figure 87 Set Component Instance Traces Levels dialog 3. Define the trace filter according to your requirements (see Table 24, Table 25 and Table 26, for an explanation of the trace filter options). 4. Type the number of events that you want written to the trace buffer in the Trace buffer size text field. Apply to trace the component instance. Click Save As to save your trace options. This is only necessary if 5. Click 6. you want to reuse the same trace filter that you have created. User Guide - Rational Rose RealTime Connexis 183 Chapter 7 Using the Connexis Viewer To define a trace filter from the Filter icon: 1. Right-click the Filter icon from the Explorer tree view. 2. Select Add Filter. The Filter Spec Sheet dialog appears. Figure 88 Filter Spec Sheet dialog 3. Type a descriptive name to identify the filter in the Filter text box. 4. Define the trace filter according to your requirements (see Table 24, Table 25 and Table 26, for an explanation of the trace filter options). 5. Click 184 OK to implement your changes and close the dialog. User Guide - Rational Rose RealTime Connexis Performing Event Tracing Setting trace filters The “Set Component Instance Trace Levels” dialog and the “Filter Spec Sheet” dialog contain the trace groups and trace types that let you set your define your trace filter. Trace groups refer to a functional area where messages can be traced in the distributed model and trace types refer to event types that can be traced. The settings for the trace groups and trace types determine what messages are traced in the executing model. When connecting to target agents in the minimal configuration, only error and warning type events for all trace groups are available. A description of how to configure the following trace groups is explained in Table 24, Table 25 and Table 26: ■ DCS Trace Options ■ Audit Trace Options ■ Protocol Messages Trace Options User Guide - Rational Rose RealTime Connexis 185 Chapter 7 Using the Connexis Viewer Table 24 DCS Trace Options DCS Tracing Filters Trace Options Controller Basic ■ Controller initialization status Basic Errors: Failure to initialize the DCS components (for example, transporter) Operational ■ Subscriber and publisher registration ■ Binding and unbinding of end ports ■ Connection establishment progress ■ Local binding indication ■ Transport failure and recovery indications Operational Warnings: Registration failures due to configuration (for example, global registration with no locator configured) Operational Errors: Subscriber and publisher registration errors and failures Advanced Transporter ■ End port proxy creation and removal ■ Auditing of end port proxies ■ Viewer/Target Agent service and connection information queries Basic ■ Encoder/decoder mismatch between transport end points ■ Data type lookup error Basic Warnings: ■ Local/remote ■ Unknown virtual circuit mismatches control messages Basic Errors: ■ Encode/decode ■ Unknown 186 errors control messages User Guide - Rational Rose RealTime Connexis Performing Event Tracing Table 24 DCS Trace Options DCS Tracing Filters Trace Options Operational ■ Connection establishment and teardown Advanced ■ Locator An indication that a message was sent over the wire and the message size in bytes Basic ■ Locator configuration (as primary or basic) Basic Errors: ■ Encode/decode errors Operational ■ Service publish and subscribe events ■ Service registration and binding status Operational Errors: ■ Encode/decode errors Advanced ■ DCS Configuration Primary and backup locator election process Basic ■ Used to indicate that user configuration settings have been overridden Operational ■ Displays the same information as basic Advanced ■ Displays the same information as basic Datagram Messaging There are currently no trace events defined for Datagram Messaging. User Guide - Rational Rose RealTime Connexis 187 Chapter 7 Using the Connexis Viewer Table 25 Audit Trace Options Audit Trace Filters Trace Options Controller Audit Basic ■ None Operational ■ Circuit audit status ■ Circuit audit timeouts ■ Unbinding of publishers or subscribers as a result of a circuit audit Advanced ■ Transporter Audit Displays same information as Operational Basic ■ None Operational ■ Transport endpoint failure recovery Advanced ■ Audit messages Locator Audit There are currently no trace events defined for Locator Audits. Target Agent Basic ■ None Operational ■ Viewer Operations Advanced ■ Trace filter configuration operations Defining a Port Reference Trace When performing a trace on a port reference, you can specify where the messages are traced, set the trace level, and set the buffer size. You can also refine your trace to use only selected component instances (identified by the CNXui). This is useful when you want to focus your trace on a particular component instance that may be experiencing errors (for example, an encode/decode error). 188 User Guide - Rational Rose RealTime Connexis Performing Event Tracing Table 26 Protocol Messages Trace Options Protocol Messages Trace option Trace Options User Data In/Out Basic ■ Enables component instance wide tracing of all circuit data that is injected into the model or sent by the model. User Data In trace events are collected after the user’s data has been decoded. User Data Out trace events are collected before the user's data has been encoded. Operational ■ Displays same information as basic Advanced ■ Network Data In/Out Displays same information as basic Basic ■ Enables component instance wide tracing of all circuit data that is received from or sent to the network. Network Data In trace events are collected before the data from a user is decoded. Network Data Out trace events are collected after the data of a user is encoded. Operational ■ Displays same information as basic Advanced ■ Displays same information as basic To define a port reference trace: 1. Select the port reference you wish to trace. 2. Right-click and select Define Trace from the popup menu. The dialog box shown in Figure 89 appears. User Guide - Rational Rose RealTime Connexis 189 Chapter 7 Using the Connexis Viewer Figure 89 Define Trace Dialog (Port reference) 3. Configure the trace reference settings according to Table 27. Table 27 190 Trace location settings Option Description User data in Causes the tracing of incoming messages to occur after the message data has been decoded. User Guide - Rational Rose RealTime Connexis Performing Event Tracing Table 27 Trace location settings Option Description User data out Causes the tracing of outgoing messages to occur before the message data has been encoded. Network data in Causes the tracing of incoming messages to occur before the message data has been decoded. Network data out Causes the tracing of outgoing messages to occur after the message data has been encoded. Figure 90 shows what reference point is used for each of the four options. If you encounter problems that you think may have been caused by encoding or decoding, you can use tracing on user and network data to ensure their accuracy. Figure 90 User and Network data designations Any combination of these checkboxes can be selected. Selecting all four causes the messages to be traced before and after encoding for outgoing messages, and before and after decoding for incoming messages. 4. Configure the Trace Level setting according to Table 28. 5. Enter a number to specify the number of events that can be written to the trace buffer in the Trace buffer size field. 6. Click the Trace Active box to apply the filter settings when you click Apply or OK. 7. Click the Open Trace Window to open a trace window for this port reference. User Guide - Rational Rose RealTime Connexis 191 Chapter 7 Using the Connexis Viewer Table 28 Trace location settings Option Description Disabled No tracing will be performed. Activity Only traces that messages are being sent. The trace event indicates both the local virtual circuit identifier and the remote virtual circuit identifier but the actual signal and message data are not traced. Signal Only the message signal will be traced. Signal and data Both the message signal and the message data will be traced. 8. Click the Filter Trace by Remote CNXui box if you want to specify the remote component instances to be included in the trace. In the list box, click on each component instance you wish to include. Note: When disabled, trace data is gathered for all remote component instances. 9. Click the OK button. Defining a Virtual Circuit Trace When performing a trace on a virtual circuit, you can specify where the messages are traced, set the trace level, and the buffer size. To define a virtual circuit trace: 1. Select the virtual circuit you wish to trace. 2. Right-click and select Define Trace from the popup menu. The dialog box shown in Figure 91 appears. 192 User Guide - Rational Rose RealTime Connexis Performing Event Tracing Figure 91 Define Trace Dialog (Virtual circuit) 3. Configure the trace reference settings according to Table 29. Table 29 Trace location settings Option Description User data in Causes the tracing of incoming messages to occur after the message data has been decoded. User data out Causes the tracing of outgoing messages to occur before the message data has been encoded. Network data in Causes the tracing of incoming messages to occur before the message data has been decoded. Network data out Causes the tracing of outgoing messages to occur after the message data has been encoded. For information on these trace reference points, refer to Figure 90. Any combination of these checkboxes can be selected. Selecting all four causes the messages to be traced before and after encoding for outgoing messages, and before and after decoding for incoming messages. 4. Configure the Trace Level setting according to Table 28. 5. Enter a number to specify the number of events that can be written to the trace buffer in the Trace buffer size field. User Guide - Rational Rose RealTime Connexis 193 Chapter 7 Using the Connexis Viewer Table 30 Trace location settings Option Description Disabled No tracing will be performed. Activity Only traces that messages are being sent. The trace event indicates both the local virtual circuit identifier and the remote virtual circuit identifier but the actual signal and message data are not traced. Signal Only the message signal will be traced. Signal and data Both the message signal and the message data will be traced. 6. Click the Trace Active box apply to the filter settings when you click Apply or OK. 7. Click the Open Trace Window to open a trace window for this virtual circuit. 8. Click the OK button. Trace Window The Trace window presents trace events formatted into columns. The Trace Window automatically scrolls to show new trace events as they arrive unless the scroll bar is not at the bottom. To pause scrolling, click anywhere in the scroll region but the bottom. To resume scrolling, drag the scroll bar to the bottom of the scroll region. There are two types of trace windows available in the Connexis Viewer: ■ Component instance trace windows. ■ Virtual circuit trace windows. Both types of trace windows provide the same function. They differ in the type of information that is displayed in them. Component Instance Trace Window The component instance trace window is shown in Figure 92. It contains four fields of information: 194 ■ Time - contains a timestamp of when the message was traced. ■ Event - this is the trace type for this trace event. User Guide - Rational Rose RealTime Connexis Trace Window ■ Level - this is the level of the trace message. ■ Data - this field contains the data that is associated with the trace. Figure 92 The component instance trace window Virtual Circuit Trace Window The virtual circuit trace window is shown in Figure 93. It contains seven fields of information: ■ Time - contains a timestamp of when the message was traced ■ Local Path - contains the Rose RealTime model path for the local side of the virtual circuit ■ <-> - contains either a --> or a <-- symbol, indicating the direction in which the message was sent ■ Remote Path - contains the Rose RealTime model path for the far side of the virtual circuit if the Target Agent is running at the far end; otherwise, the CNXui and the VCID are displayed ■ Priority - corresponds to the message priority ■ Signal - contains the message signal name if the Signal or Signal and data trace level is specified ■ Data - contains the message data if the Signal and data trace level is specified User Guide - Rational Rose RealTime Connexis 195 Chapter 7 Using the Connexis Viewer Figure 93 The virtual circuit trace window Trace Window Popup Menu The Trace window has a popup menu associated with it as shown in Figure 94. 196 User Guide - Rational Rose RealTime Connexis Trace Window Figure 94 Trace window popup menu Show trace data This opens a trace data window onto the trace data field of the selected event. The format of this window depends on whether the trace event is a network or user-side trace event. Figure 95 shows an example of the Trace Data window for ASCII data. Figure 96 shows an example of the Trace Data window for binary (network) data. User Guide - Rational Rose RealTime Connexis 197 Chapter 7 198 Using the Connexis Viewer Figure 95 The Trace Data Window with ASCII data Figure 96 The Trace Data Window with binary data User Guide - Rational Rose RealTime Connexis Trace Window Define trace Selecting the Define Trace command opens the Define Trace Levels dialog box. The content of this dialog box varies depending on the object being traced. Table 31 lists the types of traces that can be performed in Connexis and references the figures that display the Define Trace options. Table 31 Types of Traces Trace Type Figure Component instance Figure 87, “Set Component Instance Traces Levels dialog,” on page 183 Port reference Figure 89, “Define Trace Dialog (Port reference),” on page 190 Virtual circuit Figure 91, “Define Trace Dialog (Virtual circuit),” on page 193 Trace active The Trace Active command toggles on and off and is used to select whether the Trace Data window should capture any new trace events. If an inactive trace is set to active, it will reuse the values that were set in the Define Trace dialog box. Select in tree Selecting the Select in Tree command causes the object being traced to become active in the Explorer Tree View. Clear Selecting the Clear command clears the contents of the trace window. Save trace Selecting the Save Trace command brings up a Save As dialog which allows you to save the current contents of the Trace window to a file. There are two available 'formats' of trace output available. They are: ■ Comma Delimited Trace (.cdTrace) which produces a simple comma delimited line for each trace event ■ Formatted Trace (.fmtTrace) which produces a (tag : value) multiline output for each trace event User Guide - Rational Rose RealTime Connexis 199 Chapter 7 Using the Connexis Viewer Figure 97 shows a sample trace output for a virtual circuit. The top portion shows the information when Comma Delimited is selected. The bottom portion shows an example of the output when the Formatted Trace option is selected. Comma Delimited (cdTrace) Captured using Connexis Viewer Version 6.1 Time, Trace Name, Trace Level, Trace Data 945197351.15000000, Transporter, Advanced, "Transporter CdmMsgType0v1_out : CDM Message sent of length 117" 945197351.15000000, Transporter, Advanced, "Transporter CdmMsgType0v1_out : CDM Message sent of length 117" 945197362.812000000, User Data In, Operational, "Virtual circuit ID: 2, Signal name: GreetingMessage" 945197363.812000000, User Data In, Operational, "Virtual circuit ID: 2, Signal name: GreetingMessage" _____________________________________________ Formatted Record (fmtTrace) Captured using Connexis Viewer Version 6.1 Time: 945197350.609000000 Group: Transporter Level: Advanced Data: "Transporter CdmMsgType0v1_out : CDM Message sent of length 117" Time: 945197362.812000000 Group: User Data In Level: Operational Data: "Virtual circuit ID: 2, Signal name: GreetingMessage" Figure 97 200 Sample component trace output - Comma Delimited and Formatted Record User Guide - Rational Rose RealTime Connexis Trace Window Trace Header Context Menu There are times when it is desirable to define a custom layout for the Trace Window columns. Connexis Viewer allows you to perform these operations through a context menu that appears when you right-click on the header control (see Figure 98) of a Trace Window. When a new Trace Window is opened, it uses the current system default information to determine the layout of the columns and the size of the window. If you change the layout of an open Trace Window, this information is saved and used the next time that the window is opened. Figure 98 Trace Header Context menu Selecting the Restore to default entry causes the Trace Window to revert to the current default layout. Selecting the Set as default causes the Trace Window's current layout to become the new 'default' layout. Note that this will not affect windows that are already open but will cause all newly-opened trace windows to use this layout (unless they have been previously opened and modified by the user). Selecting the Hide column will cause the column the cursor is on to become hidden (for example, in the image above, the Remote Path column would become hidden. Note that you cannot hide the Data column. At the end of the menu, any currently hidden columns show up in the format Show “ ” Column. Selecting one of these entries will cause the (previously hidden) column to become visible again. The column will re-appear at its previously defined width. User Guide - Rational Rose RealTime Connexis 201 Chapter 7 Using the Connexis Viewer Generating Interaction Diagrams from Trace Output Files With Connexis, you can create interaction diagrams from trace output files, generated from traces on a port reference or a virtual circuit. The trace output files can be imported into a Rose RealTime model and rendered into collaboration and sequence diagrams. Before you generate interaction diagrams, use the Connexis Viewer to perform an event trace on a port reference (see “Defining a Port Reference Trace” on page 188) or a virtual circuit (see “Defining a Virtual Circuit Trace” on page 192) and save the trace output to a file (see “Save trace” on page 199). To generate interaction diagrams: 1. Perform an event trace on a port reference or on a virtual circuit. Ensure that the trace level is set to Signal or Signal and data. 2. Save the event trace information to file. The trace file can be formatted or comma-delimited. 3. From the tree browser of the Rose RealTime application, right-click the folder in which you want to save the collaboration and sequence diagrams that will be generated. 202 User Guide - Rational Rose RealTime Connexis Generating Interaction Diagrams from Trace Output Files Figure 99 Tree browser in Rose RealTime 4. Click Import Connexis Viewer Trace. The Import Interaction Diagram dialog appears. User Guide - Rational Rose RealTime Connexis 203 Chapter 7 Using the Connexis Viewer Figure 100 Import Interaction Diagrams dialog 5. Complete the Import Interaction Diagrams dialog according to the following table: Table 32 204 Description of Import Interaction Diagrams dialog Option Description Trace file name Browse for the trace file that you stored. This is the file that you will use to generate your collaboration and sequence diagrams. Collaboration diagram name Type or select the name of the collaboration diagram that you want to generate. Generate sequence diagram If you want to generate a sequence diagram, ensure that this check box is checked. Sequence diagram name Type the name of the sequence diagram that you want to create. User Guide - Rational Rose RealTime Connexis Generating Interaction Diagrams from Trace Output Files Table 32 Description of Import Interaction Diagrams dialog Option Description Maximum number of trace events to Type the maximum number of trace events that you want represented in your sequence diagrams. A maximum number of 256 can be selected. Include location tagged values as notes If you want to include location tagged values as notes on the collaboration diagram, ensure that this check box is selected. Include service name as If you want to include the service name association role stereotype that was used to establish the binding as the association role’s stereotype, ensure that this check box is checked. 6. Click the Import button. The collaboration diagram and the sequence diagram (if enabled) are generated. Once the generation process is complete, the diagrams appear in the display area of Rose RealTime. Note: If an error message occurs, see Reporting of error messages for a detailed description of the message. User Guide - Rational Rose RealTime Connexis 205 Chapter 7 Using the Connexis Viewer Reporting of error messages While generating interaction diagrams, you may receive an error message that provides feedback about the process. The following chart lists and explains the error messages: Error Message Description Unknown file format The file specified in the Trace file name text field is not an acceptable file format. Acceptable file formats are .cdTrace (comma delimited) or .fmtTrace (formatted). The file formats with the .cdTrace and the .fmtTrace extensions, identify the type of trace file to be processed. Unable to process trace file because it is incompatible with the current version of the toolset add-in The imported trace file has been generated by an earlier version of the Rational Connexis Viewer. The file format is incompatible with the format accepted by the toolset add-in. Import trace files must be generated by Rational Connexis version 2001A.04.00 or newer. Invalid file format The user has modified the file or an error occurred while the Connexis Viewer was attempting to write the file. Cannot process more than An attempt has been made to configure 256 trace events the tool to import more trace events than the feature can support. Log Window The log window displays the status of the connections in the executing model. Each message is preceded by a timestamp in square brackets. This timestamp indicates the time that the message was received by the Viewer. Icons indicate the type of message as summarized in Table 33. A sample log window output is shown in Figure 101. 206 User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Table 33 Log window icons Icons Meaning normal messages warning messages error messages Figure 101 The log window Displaying the Metrics Collection Metrics is a Connexis Viewer function that lets you start, display and save statistics collected on a component instance. Once metrics gathering is enabled on a Connexis library, statistics are collected on internal run-time operations and registered transports, active in the model. A Connexis library that is enabled to gather metrics, collects statistics on its internal run-time operations and on any registered transport that are active in the model. Internal run-time operations include: ■ Creating and auditing circuits ■ Encoding and decoding messages ■ Publishing and subscribing to services Transport statistics include: ■ Totals on the number and the size of message sent and received ■ Minimum and maximum sizes of the message payloads ■ Number of messages sent with and without data ■ Breakdown of application-level versus control message sent User Guide - Rational Rose RealTime Connexis 207 Chapter 7 Using the Connexis Viewer Note: All transports supplied with Connexis reports these statistics. Transports built using the Transport Integration Framework must use the API supplied by Connexis to gather transport-specific statistics at run-time. For a complete discussion of this topic, see “Using the Transport Integration Framework” on page 299. Starting Metrics Collection Metrics gathering is designed to have the smallest possible impact on performance. The Viewer connects to the component instance and request statistics on a running model that has metrics enabled in the DCS library, and the CDM transport registered. When the Viewer connects to the component instance, it sends a request to start gathering metrics and requests a reporting rate (see “Adding a Component Instance” on page 177). The component instance tells the Viewer what reporting rate it supports, describes the registered transports, and reports statistics at the appropriate interval. To collect metrics on a component instance: 1. Right-click the component instance on which you want to collect statistics. A popup window appears. 2. Select Open Metrics Window from the list. The Metrics window appears with the name of the component instance in the title bar. 3. Select the tab containing the information that you require (see “Using the Metrics Window” on page 208). Using the Metrics Window The Metrics window displays statistics collected on the internal runtime operations and registered transports of a component instance. You can access metrics information from the following window tabs. Table 34 208 Metrics Window tabs Metrics window tabs Description Summary “Summary metrics collection” on page 210 Detailed “Detailed metrics collection” on page 214 Messages “Messages metrics collection” on page 216 User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Table 34 Metrics Window tabs Metrics window tabs Description Audits “Stopping Metrics Collection” on page 234 Engineering “DCS errors metrics collection” on page 225 DCS Errors “DCS errors metrics collection” on page 225 App Errors “Application errors metrics collection” on page 228 App Incompatibility “Application incompatibility metrics collection” on page 232 User Guide - Rational Rose RealTime Connexis 209 Chapter 7 Using the Connexis Viewer Summary metrics collection Figure 102 Metrics Window: Summary Information Table 35 210 Subscriptions/Publications User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Message Type Description Number of Subscriptions The total number of subscriptions that have been registered locally, registered explicitly, registered globally through the locator, and the number of remote subscriptions that have been registered to publications in the Component Instance. Number of Publications The total number of local and global publications registrations. Number of Remote Subscriptions The number of registrations from remote subscriptions. Table 36 Messages Message Type Description Messages Sent Successfully sent user application messages with signal and data, including message data. These messages require a buffer to be send. Messages Received User application messages with signal and data received. These messages may or may not be passed to the application successfully and the application was unable to decode the message. Bytes Sent Total number of bytes sent on the transport. Includes audit, control and user messages. Bytes Received Total number of bytes received on the transport. Includes audit, control and user messages. Defining Messages/Sec and Bytes/Sec From the Summary page of the Metrics dialog, you can set the way strip chart information is displayed in the Messages/Sec and the Bytes/Sec area. The Messages/Sec area displays the number of messages sent from the component instance per second. The Bytes/Sec area displays the number of bytes sent from the component instance per second. User Guide - Rational Rose RealTime Connexis 211 Chapter 7 Using the Connexis Viewer To change the way chart settings are presented: 1. Click the Define button in the Messages/Sec or the Bytes/Sec area. The “Strip Chart Settings” dialog appears. Figure 103 Strip Chart Settings dialog 212 User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Table 37 Strip Chart Settings Settings Compute Scale Description Clicking Compute Scale analyses the strip chart and determines the minimum and the maximum values. Note: To manually set the Compute Scale values without have them overridden, set Auto-scale every to zero. Min ‘Auto-scale’ Transport Lets you set the transport that you want the strip chart to use for the minimum auto-scale value. Before setting the minimum auto-scale value, select the transport from the Transports selection area. Max ‘Auto-scale’ Transport Lets you set the transport that you want the strip chart to use for the maximum auto-scale value. Before setting the maximum auto-scale value, select the transport from the Transports selection area. Auto-scale every This sets the number of samples received from the transport before the script chart calculates the result and presents the information. Using the previous values This sets the number of previous values that the strip chart uses to calculate the result. Transports This area displays the transports available for use. User Guide - Rational Rose RealTime Connexis 213 Chapter 7 Using the Connexis Viewer Detailed metrics collection Figure 104 Metrics Window: Detailed Information 214 User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Table 38 Publications/Subscriptions Message Type Description Number of Publications Total number of Publications. Number of Global Publications Total number of global SPP registrations. Number of Local Publications Total number of local SPP registrations. Number of Subscriptions Total number of Subscriptions. Number of Explicit Subscriptions Total number of explicit SAP registrations. Number of Global Subscriptions Total number of global SAP registrations. Number of Local Subscriptions Total number of local SAP registrations. Table 39 Connections/Bindings Message Type Description DCS Controller Bindings Total number of SAP/SPP bindings. DCS Transport reported Bindings Number of ports successfully bound. This includes both SAP and SPP ports. This count may include duplicate binds if the underlying transport is lost and control messages have to be resent. Table 40 Transporter Message Type Description Successful Endpoint Bindings Number of successful transport binds. Failed Endpoint Bindings Number of transport bind failures. Successful Endpoint Resolves Number of addresses resolved successfully. Failed Endpoint Resolves Number of address resolve failures. User Guide - Rational Rose RealTime Connexis 215 Chapter 7 Using the Connexis Viewer Messages metrics collection Figure 105 Metrics Window: Messages 216 User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Table 41 Messages Message Type Description Messages Sent Connect, register registered, etc. Messages Received Connect, register registered, etc. Application Messages Sent The total number of message sent by the application. This count includes those messages sent with data and with signal only. Application Messages Received The total number of message received by the application. This count includes those messages received with data and with signal only. Audit Messages Sent Are You Alive, I Am Alive and You Are Not Responsive messages sent. Audit Messages Received Are You Alive, I Am Alive and You Are Not Responsive messages received. Control Messages Sent Connect, register registered, etc. Control Messages Received Connect, register registered, etc. Signal Only Messages Sent User application messages consisting only of a successfully sent signal. Signal Only Messages Received User application messages consisting only of a signal that was received. These messages may or may not be passed to the application successfully (for example, incompatible with protocol). Messages with Data Sent Successfully sent user application messages with signal and data, including message data. These messages require a buffer to be send. Messages with Data Received User application messages with signal and data received. These messages may or may not be passed to the application successfully and the application was unable to decode the message. User Guide - Rational Rose RealTime Connexis 217 Chapter 7 Using the Connexis Viewer Table 41 218 Messages Message Type Description Maximum Data Size Sent Size of the largest encoded data object successfully sent. This information in conjunction with EncodeExceedsMaxSize helps you engineer the size of the larger buffers in the buffer pool. Maximum Data Size Received Size of the largest encoded data object received. Minimum Data Size Sent Size of the smallest encoded data object successfully sent. This helps you engineer what is the size of the smaller buffers needed in the buffer pool. It also helps you decide setting of CNXtfms. Minimum Data Size Received Size of the smallest encoded data object successfully received. User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Audits metrics collection Figure 106 Metrics Window: Audits Information User Guide - Rational Rose RealTime Connexis 219 Chapter 7 Using the Connexis Viewer Table 42 Circuits Message Type Description Virtual Circuit Audits Sent Total number of virtual circuit audits sent. Virtual Circuit Audits Received Total number of virtual circuit audits received. Virtual Circuit Audit Failures Total number of virtual circuits removed due to unacknowledged audits. Circuit Errors Detected by Total number of invalid virtual circuits Audit removed due to audits. Table 43 220 Messages Message Type Description Out of Service (Audit Failure) Number of times an endpoint went out of service (CDM did not get IAA responses). In Service (Audit Failure) Number of times an endpoint went back into service after an Audit unresponsive failure. Audit Resets Detected Number of times an endpoint went out of service and then back into service after detecting that the other side has gone away and come back. Applies to CDM only. User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Engineering metrics collection Figure 107 Metrics Window: Engineering Information User Guide - Rational Rose RealTime Connexis 221 Chapter 7 Using the Connexis Viewer Table 44 Message Type Description No Ports Published for Service Number of times SAPs could not bind to an SPP because no SPP was registered for that service. Publications over Subscribed Number of times SAPs could not bind to an SPP because the SPPs were all fully bound. Table 45 Retransmissions Message Type Description Connection Attempt Timeout Total number of virtual circuit establishment retries. Global Subscription Attempt Timeout Total number of global SAP locator registration retries. Global Publication Attempt Timeout Total number of global SPP locator registration retries. Rejected Connection Requests The number of times retrying a connect request resulted in more than one virtual circuit being setup. The ConnectSuccess received is rejected, allowing the other side to terminate the additional circuit. Table 46 222 Subscription/Publications Circuit Binding Failures Message Type Description Insufficient Virtual Circuits (Local) Total number of times a SAP failed to register because a free virtual circuit was not available on the client-side of a connection. Insufficient Virtual Circuits (Remote) Total number of times a SAP failed to register because a free virtual circuit was not available on the server-side of a connection. User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Table 47 Parameters Exceeded Message Type Description Encoding Exceeds Buffer Size Number of times encoding an outgoing message failed. This occurs because a large enough buffer is not available. If any overridden encode function on one of the classes that describes the type being sent (i.e. attribute classes) returns 0, this results in a failure as well. Message is not sent. Encode Buffer Unavailable Number of times a buffer, of a suitable size to encode the message, was unavailable. All messages are encoded to a buffer before sending. This error may occur if the message is very large and there is no buffer available that can accept the payload. Blocking transports such as CRM also use this pool to buffer message sends while the transport is busy. If the transport becomes overloaded, message sends are buffered until there are no further buffers in the pool. Consider increasing the number of buffers in the transport pool using the CNXtbp parameter. Message is not sent. User Guide - Rational Rose RealTime Connexis 223 Chapter 7 Using the Connexis Viewer Table 47 224 Parameters Exceeded Message Type Description CNXtoql Exceeded The number of times the output queue limit is exceeded. Examine the CNXtoql parameter setting. The setting needed dependent on CNXtepql and the number of endpoints in use and number of host names being resolved (for CDM). If this only occurs during connection establishment and you also see the Connections rejected later, increase the retry delay. It could be due to retrying connects before the hostname can be resolved. If you have a highly replicated non-published unwired port doing automatic registration (i.e. a large number of SAP registrations going on at once), consider staggering the startup load on the system. Message is not sent. CNXtepql Exceeded The number of times the endpoint queue limit is exceeded. Examine the CNXtepql parameter setting. The setting needed is dependent on the maximum number of messages to be queued for an end point. If you increase this, examine the CNXtoql parameter setting as well. If this occurs during connection establishment, see the CNXtoqlExceeded description as well. Message is not sent. CNXtiql Exceeded The number of times the input queue limit is exceeded. Examine the CNXtiql parameter. It can be used to prevent Connexis from being swamped. Message is not received. User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection DCS errors metrics collection Figure 108 Metrics Window: DCS Errors Information User Guide - Rational Rose RealTime Connexis 225 Chapter 7 Using the Connexis Viewer Table 48 Transport Errors Message Type Description Failed Write Attempts Number of times the send of a message failed on the write (CDM failed on the write). Message not sent. Failed Endpoints Resolves Number of host name resolve failures. Failed Endpoints Bindings Number of transport bind failures. Transport Recoveries Number of times a transport is brought back into service after an audit has failed. Messages Dropped (Transport OOS) Number of queued messages sent to an endpoint after the audit has determined that it has gone out of service. Transport Error Messages Number of times the controller sent the transport error message. Table 49 226 Connections/Bindings Message Type Description Unavailable Transports The number of times an attempt to use an unavailable transport was made. Message is not sent/received. User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Table 49 Connections/Bindings Message Type Description VC Mismatches Number of times the virtual circuit information contained in a request does not match the current virtual circuit setup. Typically occurs during transport failures or after user applications have failed and restarted. The SAP or SPP that was previously being communicated which is no longer available (may be participating in another connection or is released). The Circuit Audit cleans up these situations. Message not sent/received. Connect Failures Sent Number of ConnectFailure responses sent in response to connect messages received. No virtual circuit is established. The reason for failing such a request is due to no further virtual circuits being available. Connect Failures Received Number of ConnectFailures received in response to connect messages sent. A virtual circuit could not be setup on the other endpoint. Table 50 Ports Message Type Description Bound Ports Number of ports successfully bound. This includes both SPP and SAP ports and may include duplicate binds. For example, a bind may occur twice for the same port if dealing with a lost transport (control messages are re-sent), or if user data messages over-take control messages. Port Binding Failures Number of times binding a port failed. User messages are not be able to be exchanged through the port. User Guide - Rational Rose RealTime Connexis 227 Chapter 7 Using the Connexis Viewer Application errors metrics collection Figure 109 Metrics Window: Application Errors Information 228 User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Table 51 Subscriber/Publisher Registrations Message Type Description Subscriber Registration Syntax Errors Number of times a SAP failed to register because its registration string had invalid syntax. Publisher Registration Syntax Errors .Number of times a SPP failed to register because its registration string had invalid syntax. Subscriber Replication Errors Number of times a SAP failed to register because its replication factor was zero. Publisher Replication Errors Number of times a SAP failed to register because its replication factor was zero. Table 52 Subscription/Publications Message Type Description Subscription Errors (DCS config) Number of times a SAP failed to register because DCS was not configured correctly. PublicationErrors (DCS config) Number of times a SPP failed to register because DCS was not configured correctly. Subscription Errors (Locator config) Number of times a SAP failed to register globally because the locator was not configured. Publication Errors (Locator config) Number of times a SPP failed to register globally because the locator was not configured. Explicit Subscription Errors (Transport spec) Number of times an SAP failed to register explicitly (for example, registerSAP(“dcs: // : /
”)) using a transport protocol because the transport was not properly configured. Global Subscription Errors (Transport spec) Number of times a SAP failed to register globally (for example, registerSAP(“dcs:/ ”)) using a transport protocol because the transport was not properly configured. User Guide - Rational Rose RealTime Connexis 229 Chapter 7 Using the Connexis Viewer Table 53 230 General Message Type Description Transport Registration Failures The number of times an attempt to use an unavailable transport was made. Message is not sent or received. Encode Failures Number of times the encoding of an outgoing message failed. This can occur when there was no buffer large enough to encode the payload, or the overridden encode function returned 0. Message is not sent. Decode Failures Number of times the decoding of an incoming message failed. Type Descriptor Version Mismatch Number of times the version of the sender’s class does not match the version expected in the receiver. You can specify the version of a class in its C++ TargetRTS property tab. Only the version of the class being sent is considered. The version(s) of its attributes are not. Message is not received. Unknown Types Received Number of times the sender’s class is not known in the receiver’s application. This can occur if the sender and receiver are in two different models (different .rtmdl files). If so, then the protocol and class being sent must be shared between the models. This failure can also occur if the class is not referenced anywhere in the receiver’s model, and so is not compiled. Message not received. Class Instantiation Failures The number of times the receiver failed to create the class to be received. There may be a problem with the default or overridden allocation method for the type descriptor of the class. Message not received User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Table 53 General Message Type Description Decodes Past Buffer End Number of times Connexis read past the end of the encoded data while decoding an incoming message. Check that the encode and decode methods in the type descriptors match exactly on the sender and receiver side. Message not received Unrecognized Signals Number of times the signal received is not recognized as valid on the receiver’s protocol. Verify that the protocols used in the sender and receiver are compatible, and properly conjugated. Message not received. Incompatible Classes The number of times the data type received with a signal is not a compatible subclass of the type that has been defined by the protocol. Verify that the protocols used in the sender and receiver are compatible and properly conjugated. Message not received. User Guide - Rational Rose RealTime Connexis 231 Chapter 7 Using the Connexis Viewer Application incompatibility metrics collection Figure 110 Metrics Window: Application Incompatibility Information 232 User Guide - Rational Rose RealTime Connexis Displaying the Metrics Collection Table 54 Incompatibilities Message Type Description Unknown Decoding Formats Number of times the data received was encoded in an unknown format. Internal Errors Number of times Connexis internal processes cannot process the message (can be user message or control message). Message is not sent. Incompatible Requests Number of times unknown control messages were received. This will not happen if all applications are running with Connexis release 6.1.1. Future Connexis releases may support additional control requests not supported by Connexis 6.1.1. Connexis informs the message sender so that a common request interface can be used. See your user guide for that Connexis release. Connexis 6.1.1 can not inter-operate with applications using an earlier Connexis release. Message is not received. Incompatible Encoding This will not happen if all applications are running with Connexis release 6.1.1. Future Connexis releases may support enhanced existing encoding formats that are not supported by Connexis 6.1.1. Connexis informs the message sender so that a common version of encoding can be used. See your user guide for that Connexis release. Connexis 6.1.1 can not inter-operate with applications using an earlier Connexis release. Message is not received. Unknown Incoming Message Types The number of times the incoming message was of an unknown type. User Guide - Rational Rose RealTime Connexis 233 Chapter 7 Using the Connexis Viewer Stopping Metrics Collection Closing the metrics collection window stops metrics reporting on the selected component instance. To stop collecting Metrics: 1. Click the Close button on the top right corner of the window. Saving Collected Metrics Once you start collecting metrics on a component instance, you could save the statistics for further analysis. Metrics statistics are saved in a tab-separated format that can be imported directly into popular spreadsheet programs. To save collected metrics: 1. Click the Save Metrics button. 2. Type the name of the file you want to save in the “Save Metrics As” dialog box. The file is saved as a ComponentInstanceMetrics (CIMetrics) file. You can open this file a spreadsheet application like Microsoft Excel or in any text application. Viewer Tips and Usage Notes This section provides some tips and usage notes to make it easier to use the Connexis Viewer: ■ Capturing Pre-Viewer Session Messages ■ Error and Warning Tracing ■ Maximizing Viewer Responsiveness Capturing Pre-Viewer Session Messages It is possible to capture traces before a target session is established. The CNXaas parameter will enable the following trace events: 234 ■ controller ■ locator ■ transporter ■ component-wide tracing for all data sent to, and received from, all unwired DCS ports User Guide - Rational Rose RealTime Connexis Viewer Tips and Usage Notes ■ any errors or warnings Note: In this mode, only the signal, data, and virtual circuit are indicated. Error and Warning Tracing Connexis Viewer provides capabilities for tracing and filtering software errors and warnings. Software errors Software errors are used to indicate anomalous conditions that prevent user data from being transported. Software errors are filtered on a component instance basis, that is, across all functional groups. There are many causes of software errors. These include: ■ Resource depletion, for example, running out of virtual circuits ■ Application registration errors, for example, syntax errors in registration string ■ Internal Connexis errors, for example, unexpected message type processed by a DCS Capsule, initialization errors ■ messages being discarded due to type mismatches (on input) Software warnings Software warnings are used to indicate conditions that will prevent Connexis from operating as configured or that can potentially lead to user data being lost. For example, an unexpected message or an unknown message type may cause a software warning. Maximizing Viewer Responsiveness Under heavy load, you may sometimes notice that the Viewer becomes unresponsive, that is, right-clicking does not immediately bring up the context menu. This occurs especially if there are many components running 'locally', on the same CPU as the Viewer. To remedy this situation, use the Task Manager to set the Priority of the Viewer to High as follows: 1. Right click on the Taskbar and select Task Manager. User Guide - Rational Rose RealTime Connexis 235 Chapter 7 Using the Connexis Viewer 2. In the Processes tab of the Task Manager, right click on the ConnexisViewer entry. 3. Use the Set Priority menu item to set the Viewer's priority to High. Note: If the Viewer is still unresponsive, you can try to reduce the Viewer load by closing trace windows that you do not need to have open. 236 User Guide - Rational Rose RealTime Connexis Chapter 8 Using the Connexis Metrics Service Rational Connexis provides capabilities to collect real-time DCS metrics information within an executing Rose RealTime model. You can collect and report metrics on each running component instance. The DCS performance information that is collected by the DCS metrics service can be used to tune the DCS command line options. Metrics services are only available within DCS library components that have been compiled with metrics collection capabilities enabled. At run-time, metrics data can be obtained from within a Connexis enabled model by subscribing to the metrics service. Although you can subscribe to the metrics service at anytime, you will not be connected to the metrics service until the service is published within the DCS layer. Obtaining Metrics Data with a Metrics Service The following sections explain how to collect metrics from a Connexis component instance at runtime. ■ Enabling Metrics in the DCS library ■ Adding a Metrics Port ■ Subscribing to the Metrics Service ■ Collecting and Processing Metrics User Guide - Rational Rose RealTime Connexis 237 Chapter 8 Using the Connexis Metrics Service Enabling Metrics in the DCS library The DCS libraries installed with Connexis are metrics-enabled by default. If you re-build your DCS library, make sure that the metrics service is enabled. For more information on how to configure your libraries, see “Customizing and Porting DCS Libraries” on page 289. Adding a Metrics Port Before you can interact with the Connexis metrics service, you must add a metrics port to the capsule in your model. You can add a metrics port manually or a the Connexis Capsule Configuration Tool. To add a metrics port manually: 1. Open your model and ensure that the DCS model interface packages are shared (see “Sharing DCS Interfaces” on page 84). 2. Open the package Logical View::RTDInterface. 3. Drag a port from the RTDMetrics protocol into your model capsule and make the port non-wired with notification enabled. To add a metrics port with the Connexis Capsule Configuration Tool: 1. Use the Connexis Capsule Configuration Tool to configure the newly created port (see “Configuring Connexis Capsules” on page 85). The newly created and configured port is used to subscribe to the metrics service. Subscribing to the Metrics Service All of the capsules that are subscribing to the Connexis metrics service must create a registration port that realizes the RTDMetrics protocol. The following list defines the syntax used to register the subscriber port under various circumstances. ■ rTDMetrics.registerSAP("dcs:RTDMetrics"); This form is used in detailed code to register the subscriber port to the metrics service of the local component instance. Note: There is no "/" in the registration string after the colon. 238 User Guide - Rational Rose RealTime Connexis Obtaining Metrics Data with a Metrics Service ■ rTDMetrics.registerSAP("dcs:// : /RTDMetrics"); This form is used in detailed code to register the subscriber port to the metrics service of another component instance. ■ dcs:RTDMetrics This form is used in the “Registeration Override field of the port Specification Sheet. It is used to protect the port when automatic registration is used. Once the port is bound, you can send the appropriate signals to obtain metrics data as described in the following section, Collecting and Processing Metrics. Collecting and Processing Metrics To obtain metrics from inside your application, you must subscribe to the metrics service. This service is accessible through the RTDMetrics protocol. The interface defined by the the RTDMetrics protocol provides the following functions: ■ Turns on/off gathering of raw metrics data ■ Obtains metrics data constantly or periodically ■ Clears collected metrics data This interface is asynchronous, and is defined in more detail in Table 55 and Table 56. Table 55 summarizes the output signals sent by the application. Table 56 summarizes the input signals received by the application. Table 55 RTDMetrics Out Signals Signals Description rtdMetricsCollectOn Sent by the user application to turn metrics collection on for this session. rtdMetricsCollectOff Sent by the user application to turn metrics collection off for this session. User Guide - Rational Rose RealTime Connexis 239 Chapter 8 Using the Connexis Metrics Service Table 55 RTDMetrics Out Signals Signals Description rtdMetricsClear Sent by the user application to clear the metrics counter values for all metrics sessions. rtdMetricsInterval Sent by the user application to set the time interval at which collected metrics are sent to this session. rtdMetricsGet Sent by the user application to request the collection of metrics to this point. Table 56 RTDMetrics In Signals Signals Description rtdMetricsCollectOnConfirm rtdMetricsCollectOnFail Response sent by DCS to the user application to confirm/deny turning metrics collection on for this session. rtdMetricsCollectOffConfirm rtdMetricsCollectOffFail Response sent by DCS to the user application to confirm/deny turning metrics collection off for this session rtdMetricsClearConfirm rtdMetricsClearFail Response sent by DCS to the user application to confirm/deny clearing the metrics storage for all metrics sessions. rtdMetricsIntervalConfirm rtdMetricsIntervalFail Response sent by DCS to the user application to confirm/deny setting a time interval at which collected metrics will be sent to this session. rtdMetricsGetConfirm rtdMetricsGetFail Response sent by DCS to the user application to confirm/deny request for the collected metrics data. By default, the DCS does not collect metrics. If you want to collect metrics during your application (for example, collect metrics on activities taking place prior to binding to the metrics service and turning collection on), use command line parameter -CNXm=1. This will turn on metrics collection when the DCS starts up. This should be set on the component instance with metrics that you want to collect. 240 User Guide - Rational Rose RealTime Connexis Obtaining Metrics Data with a Metrics Service The RTDStats and RTDTransportStats classes (see package Logical View::RTDInterface in your Connexis model) are used to define the metrics data provided by the metrics service. The following diagrams, Class diagram of the metrics classes and Class diagram of the metrics classes illustrate the relationship between the RTDStats and RTDTransportStats class and displays the corresponding methods and attributes. User Guide - Rational Rose RealTime Connexis 241 Chapter 8 Using the Connexis Metrics Service Figure 111 Class diagram of the metrics classes 242 User Guide - Rational Rose RealTime Connexis Using Metrics and the Connexis Viewer The class diagram Figure 111 continues on Figure 112, showing the attributes of the RTDTransportStats class. Figure 112 Class diagram of the metrics classes Note: An example of the usage of metrics can be seen in the model metricsCollector in the $RoseRT_Home/CONNEXIS/C++/examples directory. Using Metrics and the Connexis Viewer Another way of obtaining metrics information on a component instance is by using the Connexis Viewer. Metrics collection is turned on when the metrics window opens. If you want information on metrics collected prior to the opening of the metrics window, specify the -CNXm=1 command line argument on the component instance being monitored. This turns metrics collection on as soon as DCS starts. User Guide - Rational Rose RealTime Connexis 243 Chapter 8 Using the Connexis Metrics Service The Viewer can be used at the same time as the metrics service that you registered. You can obtain metrics data from the metrics service and from the Viewer. Note: All the metrics sessions are updated when the metrics counters are reset from the Viewer or via the port interfaces. 244 User Guide - Rational Rose RealTime Connexis Chapter 9 Registration String Grammar Registration String Grammar provides information on the BackusNaur Form (BNF) Grammar for the registerSAP and registerSPP commands. You can use the grammar below to validate your registration strings. Registration String Grammar for DCS Registrations ::= dcs:[[ ]/] [(
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.3 Linearized : Yes Create Date : 2001:09:19 15:48:46 Producer : Acrobat Distiller 4.05 for Windows Author : Rational Software Corporation Title : User Guide - Rational Rose RealTime Connexis Creator : FrameMaker 5.5.6p145 Modify Date : 2001:09:19 16:00:55-04:00 Subject : Connexis User Guide Page Count : 384 Page Mode : UseOutlines Page Layout : SinglePageEXIF Metadata provided by EXIF.tools