NonStop Server for Java Message Service C++ API Programmer’s Guide Abstract NonStop Server for Java Message Service (NSJMS) is the JMS provider that implements Sun Microsystems Java Message Service (JMS) API, version 1.0.2, on HP NonStop™ S-series and HP Integrity NonStop NS-series systems. Sun Microsystems JMS API provides a generic set of interfaces that enable JMS clients to exchange messages.
Part Number Published 526459-003 February 2013
Document History Part Number Product Version Published 526459-001 NSJMS 3.0 November 2003 526459-002 NSJMS 3.0 April 2005 526459-003 NSJMS 3.
Legal Notices Copyright 2013 Hewlett-Packard Development Company L.P. Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license. The information contained herein is subject to change without notice.
NonStop Server for Java Message Service C++ API Programmer’s Guide Glossary Index What’s New in This Manual v Manual Information v New and Changed Information Examples Figures v About This Manual vii Overview vii Who Should Use This Manual vii How This Manual Is Organized vii Related Manuals viii Notation Conventions viii 1.
Contents 3. Installation and Configuration for TNS/E 3. Installation and Configuration for TNS/E NSJMS C++ API System Requirements 3-1 Hardware 3-1 Software 3-1 Minimum Disk Space 3-1 NSJMS C++ API Installation Process 3-1 Before You Begin the Installation 3-1 Run the IPSetup Program 3-2 Unpax the NSJMS C++ API Product Files. Install and Configure the NSJMS C++ API NSJMS C++ API Directory Structure 3-9 NSJMS Properties File 3-9 Uninstalling the NSJMS C++ API 3-10 3-3 3-6 4.
Contents 6. NSJMS C++ API Sample Client Applications 6. NSJMS C++ API Sample Client Applications PTP Sample Applications 6-1 SimpleSender.cpp 6-1 SimpleReceiver.cpp 6-4 Pub/Sub Sample Applications 6-8 SimplePublisher.cpp 6-8 SimpleConsumer.cpp 6-11 7. Managing the NSJMS C++ API Environment NSJMS Administrative Utility Commands and Attributes for the NSJMS C++ API 8.
Contents Glossary Glossary Index Examples Example 6-1. Example 6-2. Example 6-3. Example 6-4. SimpleSender.cpp Sample Client Application 6-2 SimpleReceiver.cpp Sample Client Application 6-5 SimplePublisher.cpp Sample Client Application 6-9 SimpleConsumer.cpp Sample Client Application 6-12 Figures Figure 1-1.
What’s New in This Manual Manual Information NonStop Server for Java Message Service C++ API Programmer’s Guide Abstract NonStop Server for Java Message Service (NSJMS) is the JMS provider that implements Sun Microsystems Java Message Service (JMS) API, version 1.0.2, on HP NonStop™ S-series and HP Integrity NonStop NS-series systems. Sun Microsystems JMS API provides a generic set of interfaces that enable JMS clients to exchange messages.
What’s New in This Manual New and Changed Information Updated the procedure, Uninstalling the NSJMS C++ API on page 3-11. Updated the code in the procedure, Compiling User Written C++ Programs on page 5-13. Updated the “NSJMS C++ API” to “NSJMS C++ APIs” in chapter 5, Using the NSJMS C++ APIs on page 5-1.
About This Manual Overview The NonStop Server for Java Message Service C++ API Programmer’s Guide explains how to install, operate, manage, and troubleshoot the NSJMS C++ API on HP NonStop systems. Who Should Use This Manual This manual is written for anyone who installs, manages, or monitors the NSJMS C++ API on a NonStop server. It is assumed the reader is already familiar with Sun Microsystems published specification, Java Message Service, Version 1.0.2.
About This Manual Related Manuals Related Manuals Depending on the tasks you are performing, other manuals you might need are: NonStop Server for Java Message Service User’s Manual DSM/SCM User’s Guide IPSetup User’s Guide C/C++ Programmer’s Guide Open System Services Management and Operations Guide NonStop Server for Java (NSJ) Programmer’s Guide nld and noft Manual Open System Services Shell and Utilities Reference Manual Notation Conventions Hypertext Links Blue underline is used to
About This Manual General Syntax Notation italic computer type. Italic computer type letters within text indicate C and Open System Services (OSS) variable items that you supply. Items not enclosed in brackets are required. For example: pathname [ ] Brackets. Brackets enclose optional syntax items. For example: TERM [\system-name.]$terminal-name INT[ERRUPTS] A group of items enclosed in brackets is a list from which you can choose one item or none.
About This Manual Notation for Messages Quotation marks around a symbol such as a bracket or brace indicate the symbol is a required character that you must type as shown. For example: "[" repetition-constant-list "]" Item Spacing. Spaces shown between items are required unless one of the items is a punctuation symbol such as a parenthesis or a comma. For example: CALL STEPMOM ( process-id ) ; If there is no space between two items, spaces are not permitted.
About This Manual Notation for Messages Bold Text. Bold text in an example indicates user input typed at the terminal. For example: ENTER RUN CODE ?123 CODE RECEIVED: 123.00 The user must press the Return key after typing the input. Nonitalic text. Nonitalic letters, numbers, and punctuation indicate text that is displayed or returned exactly as shown. For example: Backup Up. lowercase italic letters. Lowercase italic letters indicate variable items whose values are displayed or returned.
About This Manual Change Bar Notation % Percent Sign. A percent sign precedes a number that is not in decimal notation. The % notation precedes an octal number. The %B notation precedes a binary number. The %H notation precedes a hexadecimal number. For example: %005400 %B101111 %H2F P=%p-register E=%e-register Change Bar Notation Change bars are used to indicate substantive differences between this manual and its preceding version.
1 Introduction to the NSJMS C++ API NSJMS is the JMS provider that implements Sun Microsystems Java Message Service (JMS) API, version 1.0.2, on NonStop systems. Sun Microsystems JMS API provides a generic set of interfaces that enable JMS clients to exchange messages. The NSJMS C++ API implements a subset of the functionality provided by the Sun JMS API, and is used by C++ client applications running on a NonStop system to interoperate with other JMS clients.
Introduction to the NSJMS C++ API Client Application Figure 1-1. NSJMS C++ API Client Messaging on a NonStop System Client Application NSJMS C++ API Library SQL/MX DP2 DP2 DP2 Tables Tables Tables VST005.vsd Client Application A client application is a user-written application that uses the NSJMS C++ API Library to exchange messages with other JMS client applications. NSJMS C++ API Library The NSJMS C++ API Library provides a set of interfaces that enables JMS clients to exchange messages.
Introduction to the NSJMS C++ API NSJMS C++ API Interoperability with NSJMS Clients can send or receive messages from one product and then receive or send messages using the other product. All message types are supported along with access methods for JMS headers and properties. ObjectMessages are supported, although the message body is returned as a byte array instead of as a Java object. MapMessage and StreamMessage object access methods are not provided.
Introduction to the NSJMS C++ API NSJMS C++ API Interoperability with NSJMS The life cycle for messages sent is: Create a message object using the Session::createXXXMessage() methods Add data to the message using the Message::setXXX() methods Send a message using the Producer::send() method Free message resources using the Session::freeMessage() method The life cycle for messages received is: Receive a message using the Consumer::receive() method Retrieve data from the message using t
2 Installation and Configuration for TNS/R NSJMS C++ API System Requirements Hardware HP NonStop S-series server Software HP NonStop operating system (T9050G06), G06.
Installation and Configuration for TNS/R Run the IPSetup Program Determine whether you will use DSM/SCM to move files to Installation Subvolumes (ISVs) after files are placed on your workstation. For additional information about using DSM/SCM, see the DSM/SCM User’s Guide. Note. Using DSM/SCM is optional for G06.20 or later RVUs, but is recommended. Run the IPSetup Program Use the IPSetup program to place the NSJMS C++ API components on your host NonStop S-series server.
Installation and Configuration for TNS/R Unpax the NSJMS C++ API Product Files. 8. On the Host File Placement screen you can either accept the default disk locations or browse to locations of your choice. Click Next when you are satisfied with the locations. 9. On the Placement Manifest screen review the file locations. You can click Back to go back and change the file locations. When you are satisfied with the locations, click Next. This step can take a few minutes to complete. 10.
Installation and Configuration for TNS/R Unpax the NSJMS C++ API Product Files. 5. Run ZPHIRNM to perform the RENAME step. Note. If the option Manage OSS Files was not selected in the DSM/SCM planner interface in Step 2 above, the NSJMS C++ API PAX file is in the Guardian subvolume $ISV.ZOSSUTL (where ISV is the name of your installation subvolume). Use COPYOSS to extract and place the contents of the NSJMS C++ API PAX file into the OSS file system.
Installation and Configuration for TNS/R Unpax the NSJMS C++ API Product Files. install-dir is the user-specified installation directory and T2811-version is the vproc of this RVU (for example, T2811V10_30SEP2003_V10). Note. Running the PINSTALL command does not affect any environment currently running on your NonStop S-series server. 7. Go to Install and Configure the NSJMS C++ API on page 2-6 for detailed instructions about running the install script and configuring the NSJMS C++ API.
Installation and Configuration for TNS/R Install and Configure the NSJMS C++ API Install and Configure the NSJMS C++ API Note. The remaining installation steps do not require super.super privileges. However, to maintain a secure environment, you should choose the same user ID that is configured for the OSS environment and from under which you run your existing NSJMS applications. Use this user ID to perform the following installation steps. 1.
Installation and Configuration for TNS/R Install and Configure the NSJMS C++ API where T1251-version is the vproc of the NSJMS (T1251) release (for example, T1251V30_30SEP2003_V30). 5. Compile the sample programs by using the following commands. The sample programs use the destinations created in Step 4 above: OSH: cd /usr/tandem/nsjms/T2811-version/examples OSH: make 6. Test the sample programs You will need two OSS shells to test each sample program. Note.
Installation and Configuration for TNS/R NSJMS C++ API Directory Structure b.
Installation and Configuration for TNS/R NSJMS Properties File TANDEM_SYSTEM_NSK.JMS_SCHEMA.LIBNSJMSC_T2811-version. This file contains the execution plans for the SQL statements. /examples – Contains SimpleSender.cpp. This sample program sends simple messages to a queue. SimpleReceiver.cpp. This sample program receives simple messages from a queue. SimplePublisher.cpp. This sample program publishes simple messages to a topic. SimpleConsumer.cpp.
Installation and Configuration for TNS/R Uninstalling the NSJMS C++ API API test environment, using a fully qualified filename or an environment variable, as shown in the sample programs. For additional information about using the NSJMS properties file as an argument to the Session constructor, see Creating a Session on page 5-3. Uninstalling the NSJMS C++ API To remove an installed version of the NSJMS C++ API, follow these steps from within the OSS environment: 1.
3 Installation and Configuration for TNS/E NSJMS C++ API System Requirements Hardware HP NonStop NS-series server Software HP NonStop operating system (T9050H01) NonStop OSS (T8620H01) NonStop Server for Java Message Service (T1251H10) TNS/R Native C++ (TXXXXXXX) Minimum Disk Space 4 Megabytes NSJMS C++ API Installation Process This subsection describes what you need to do before installing the NSJMS C++ API, and explains how to install and configure the NSJMS C++ API on a NonStop NS-series system.
Installation and Configuration for TNS/E Run the IPSetup Program Determine whether you will use DSM/SCM to move files to Installation Subvolumes (ISVs) after files are placed on your workstation. For additional information about using DSM/SCM, see the DSM/SCM User’s Guide. Run the IPSetup Program Use the IPSetup program to place the NSJMS C++ API components on your host NonStop NS-series server.
Installation and Configuration for TNS/E Unpax the NSJMS C++ API Product Files. 8. On the Host File Placement screen you can either accept the default disk locations or browse to locations of your choice. Click Next when you are satisfied with the locations. 9. On the Placement Manifest screen review the file locations. You can click Back to go back and change the file locations. When you are satisfied with the locations, click Next. This step can take a few minutes to complete. 10.
Installation and Configuration for TNS/E Unpax the NSJMS C++ API Product Files. 5. Run ZPHIRNM to perform the RENAME step. Note. If the option Manage OSS Files was not selected in the DSM/SCM planner interface in Step 2 above, the NSJMS C++ API PAX file is in the Guardian subvolume $ISV.ZOSSUTL (where ISV is the name of your installation subvolume). Use COPYOSS to extract and place the contents of the NSJMS C++ API PAX file into the OSS file system.
Installation and Configuration for TNS/E Unpax the NSJMS C++ API Product Files. install-dir is the user-specified installation directory and T2811-version is the vproc of this RVU (for example, T2811H10_30MAY2005_H10). 7. Go to Install and Configure the NSJMS C++ API on page 3-6 for detailed instructions about running the install script and configuring the NSJMS C++ API.
Installation and Configuration for TNS/E Install and Configure the NSJMS C++ API Install and Configure the NSJMS C++ API Note. The remaining installation steps do not require super.super privileges. However, to maintain a secure environment, you should choose the same user ID that is configured for the OSS environment and from under which you run your existing NSJMS applications. Use this user ID to perform the following installation steps. 1.
Installation and Configuration for TNS/E Install and Configure the NSJMS C++ API c. Change the file format by typing: TACL: V $SYSTEM.ZDLL TACL: fup alter zjmscdll, code 800 TACL: fup alter yjmscdll, code 800 The installation is completed. To run the sample application perform steps 5 through 9: 5. Set the NSJMS HOME variable: a. Go to OSS. b.
Installation and Configuration for TNS/E Install and Configure the NSJMS C++ API You need two OSS shells to test each sample program. Caution. It is assumed that the NSJMS_HOME variable exists and is set to the home directory of your NSJMS (T1251) installation as specified in Step a a.
Installation and Configuration for TNS/E NSJMS C++ API Directory Structure Your Publish and Subscribe sample program output will be similar to: OSH: cd examples OSH: SimpleConsumer -topic T1 -count Consumer has been set OSH: Received message #0: Publishing OSH: Received message #1: Publishing OSH: Received message #2: Publishing OSH: Received message #3: Publishing OSH: Received message #4: Publishing 5 this this this this this message message message message message 0 1 2 3 4 OSH: cd examples OSH: Si
Installation and Configuration for TNS/E NSJMS Properties File SimpleReceiver.cpp. This sample program receives simple messages from a queue. SimplePublisher.cpp. This sample program publishes simple messages to a topic. SimpleConsumer.cpp. This sample program subscribes and consumes messages from a topic. NSJMS Properties File The NSJMS C++ API uses the NSJMS properties file to store and retrieve application properties. The NSJMS properties file name is nsjms.
Installation and Configuration for TNS/E Uninstalling the NSJMS C++ API Uninstalling the NSJMS C++ API To remove an installed version of the NSJMS C++ API, follow these steps from within the OSS environment: 1. Remove the NSJMS C++ API schema file from the /sqlmx/USERMODULES directory by using these commands: OSH: cd /usr/tandem/sqlmx/USERMODULES OSH: rm TANDEM_SYSTEM_NSK.JMS_SCHEMA.
Installation and Configuration for TNS/E Uninstalling the NSJMS C++ API NonStop Server for Java Message Service C++ API Programmer’s Guide—526459-002 3-12
4 NSJMS C++ API Classes and Methods This section briefly describes the following NSJMS C++ API classes and the methods associated with each class. Note. Detailed programmatic descriptions of the NSJMS C++ API classes and methods are located in /usr/tandem/nsjms/T2811-version/doc, where T2811-version is the vproc of this RVU (for example, T2811V10_30SEP2003_V10).
NSJMS C++ API Classes and Methods BytesMessage Class BytesMessage Class The BytesMessage class extends the Message class and sends a message that contains a stream of uninterpreted bytes. BytesMessage Methods Description readBytes Read a portion of the bytes-message stream. writeBytes Write a byte array to the bytes-message stream. Consumer Class The Consumer class is a client that uses a message consumer to receive messages from a destination.
NSJMS C++ API Classes and Methods Message Class MapMessage Methods Description (page 2 of 2) setLong Set a long value with the given name, into the Map. setShort Set a short value with the given name, into the Map. setString Set a string value with the given name, into the Map. Message Class The Message class is the base class of all message classes. Message Methods Description (page 1 of 2) clearProperties Clears the message’s header fields and properties, the body is not cleared.
NSJMS C++ API Classes and Methods ObjectMessage Class Message Methods Description (page 2 of 2) setBytesProperty Sets a byte array property value with the specified name into the message. setDoubleProperty Sets a double property value with the specified name into the message. setFloatProperty Sets a float property value with the specified name into the message. setIntProperty Sets an integer property value with the specified name into the message.
NSJMS C++ API Classes and Methods Producer Class Producer Class The Producer class is a client that uses a message producer to send messages to a destination. A Producer is created by passing a destination to a createProducer() method supplied by a Session. Producer Methods Description send Send a message to the destination. Use the Producer's default delivery mode and priority, and use the Destination’s default time to live.
NSJMS C++ API Classes and Methods StreamMessage Class Session Methods Description (page 2 of 2) freeMessage Deallocates resources for a Message instance. freeProducer Deallocates resources for a Producer instance. unsubscribe Unsubscribe from a durable subscription that has been created by a client. StreamMessage Class The StreamMessage class extends the Message class and sends a message that contains a stream of primitives.
NSJMS C++ API Classes and Methods TextMessage Class TextMessage Class The TextMessage class extends the Message class and sends a message that contains a character string. TextMessage Methods Description setText Gets the string containing the message's data.
NSJMS C++ API Classes and Methods TextMessage Class NonStop Server for Java Message Service C++ API Programmer’s Guide—526459-002 4-8
5 Using the NSJMS C++ APIs This section describes The functionality that must be implemented outside of the NSJMS C++ APIs (see Establishing Destinations and Managing Transactions External to the NSJMS C++ API on page 5-1). How to develop NSJMS C++ API client applications (see Developing NSJMS C++ API Client Applications on page 5-2). How to build clients that use NSJMS C++ API classes (see Building NSJMS C++ API Client Applications on page 5-12).
Using the NSJMS C++ APIs Managing Transactions If no explicit ID is specified, the ID is generated by adding one to the current highest ID. Destination IDs cannot be changed once assigned. You must delete and re-create a destination to change an ID. Managing Transactions Transactions and acknowledge mode are not part of the NSJMS C++ API, but externally defined transactions are supported.
Using the NSJMS C++ APIs Creating a Session Creating a Session A Session is a context used to create and free all NSJMS C++ APIs objects. A Session provides methods for creating Consumers (receivers and subscribers), Producers, Durable Subscribers, BytesMessages, MapMessages, ObjectMessages, StreamMessages, and TextMessages. A Session object is created using a constructor which specifies a file name containing the NSJMS properties file.
Using the NSJMS C++ APIs Populating a Message with Data Message class The Message class is the base class of all message subclasses. The Message class defines the JMS header and property methods used for all message types. A JMS Message is made up of these components: Message Header Message Properties Message Body Message Header All messages support the same set of header fields. Header fields contain values used by both clients and providers to identify and route messages.
Using the NSJMS C++ APIs Populating a Message with Data client receives a message, its properties are in read-only mode. If a client attempts to set properties at this point, an NSJMS_Exception is thrown. Note that header fields are distinct from properties.
Using the NSJMS C++ APIs Sending a Message Sending a Message NSJMS C++ APIs client uses a Producer to send messages to a specified destination. A message producer is an object created by a session that is used by clients to send messages to queues or topics. The PTP messaging application and the Pub/Sub messaging application both use the Producer class as their message producer.
Using the NSJMS C++ APIs Sending a Message A client can send a message using the default delivery mode, priority, and time-to-live for messages sent by a message producer or, a client can specify a delivery mode, priority, and time-to-live per message.
Using the NSJMS C++ APIs Sending a Message this expiration value is converted to a Julian timestamp and stored in the msg_expiration column of the MESSAGE table. The conversion algorithm is: julian = (millis + MILLIS_TILL_1970) * 1000; where MILLIS_TILL_1970 is 210866760000009. If the time-to-live value is 0, then the message remains in the database forever, or until it is deleted by a queue receiver or manually deleted.
Using the NSJMS C++ APIs Receiving a Message Receiving a Message NSJMS C++ APIs client uses a Consumer to receive messages from a specified destination. A message consumer is created by passing a destination name (queue or topic) and consumer type to the createConsumer() method supplied by a Session class. The PTP messaging application and the Pub/Sub messaging application both use the Consumer class as its message consumer.
Using the NSJMS C++ APIs Receiving a Message method results in the Consumer destructor being called, which frees all memory used by the Consumer.
Using the NSJMS C++ APIs Retrieving Data from a Message Creating the consumer for a topic (a durable subscriber), starting a transaction, receiving the message, and then ending the transaction is shown in this code fragment: char *clientID = “MyClientID”; char *subscriptionName = “MySubName”; char *topicName = “MyTopic”; // Creating a Durable Subscriber Consumer *pConsumer = pSes->createDurableSubscriber( clientID, subscriptionName, topicName); // Starting Transaction, Receiving the Message BEGINTRANSACTI
Using the NSJMS C++ APIs Building NSJMS C++ APIs Client Applications fragments. It is good practice to always test the message class before casting, so that unexpected errors are handled gracefully.
Using the NSJMS C++ APIs Compiling and Linking User Written C++ Programs for use with the NSJMS C++ API Compiling and Linking User Written C++ Programs for use with the NSJMS C++ API Information about compiling and linking user written C++ programs for use with the NSJMS C++ APIs are described in: Compiling User Written C++ Programs Linking User Written C++ Programs on page 5-14 Detailed descriptions of the compile options and link options can be found in these manuals: nld and noft Manual — descr
Using the NSJMS C++ APIs Compiling and Linking User Written C++ Programs for use with the NSJMS C++ API The contents of nsjmsc.h are: /** * Copyright (c) Hewlett-Packard Company, 2002-2003 * Protected as an unpublished work. * All rights reserved.
Using the NSJMS C++ APIs Running User Written C++ Programs To include the libnsjmsc.a archive file when building the user code, add the following two options: -lnsjmsc -L$(CAPI_HOME)/lib The -lnsjmsc option searches for a library named libnsjmsc.a. The “lib” at the beginning of the name, and the “.a” at the end are implied. -lztlhsrl -lzrwslsrl -lzclisrl -lzcplsrl These TNS/R shared run-time libraries (SRLs) are required.
Using the NSJMS C++ APIs Running User Written C++ Programs NonStop Server for Java Message Service C++ API Programmer’s Guide—526459-002 5-16
6 NSJMS C++ API Sample Client Applications This section contains NSJMS C++ API sample client applications along with brief descriptions of the Point-to-Point (PTP) and Publish/Subscribe (Pub/Sub) messaging models. Source code files for the sample client applications described in this section are provided as part of the NSJMS C++ API software package. They reside (by default) in the /usr/tandem/nsjms/T2811-version/examples directory.
NSJMS C++ API Sample Client Applications SimpleSender.cpp Example 6-1. SimpleSender.cpp Sample Client Application (page 1 of 3) /** * * Copyright (c) Hewlett-Packard Company, 2002-2003 * Protected as an unpublished work. * All rights reserved.
NSJMS C++ API Sample Client Applications SimpleSender.cpp Example 6-1. SimpleSender.cpp Sample Client Application (page 2 of 3) // Creating the Producer. pProducer = pSes->createProducer(destName); for (unsigned long count = 0; count < msgCount; count++) { strstream msg; // Setting Message msg<<"Sending message "<createTextMessage(); pMsg->setStringProperty("test","SimpleSender"); // Setting Text pMsg->setText (msg.
NSJMS C++ API Sample Client Applications SimpleReceiver.cpp Example 6-1. SimpleSender.
NSJMS C++ API Sample Client Applications SimpleReceiver.cpp Example 6-2. SimpleReceiver.cpp Sample Client Application (page 1 of 3) /** * * Copyright (c) Hewlett-Packard Company, 2002-2003 * Protected as an unpublished work. * All rights reserved.
NSJMS C++ API Sample Client Applications SimpleReceiver.cpp Example 6-2. SimpleReceiver.cpp Sample Client Application (page 2 of 3) // Creating the Consumer.
NSJMS C++ API Sample Client Applications SimpleReceiver.cpp Example 6-2. SimpleReceiver.
NSJMS C++ API Sample Client Applications Pub/Sub Sample Applications Pub/Sub Sample Applications A Pub/Sub messaging application is a one-to-many messaging model that uses topics for messaging destinations. A message is published by a sending client to a topic where any receiving client who is subscribed to the topic can receive the message. A topic retains a message until the message expires. You can use the SimplePublisher.cpp on page 6-8 and SimpleConsumer.
NSJMS C++ API Sample Client Applications SimplePublisher.cpp Example 6-3. SimplePublisher.cpp Sample Client Application (page 1 of 3) /** * * Copyright (c) Hewlett-Packard Company, 2002-2003 * Protected as an unpublished work. * All rights reserved.
NSJMS C++ API Sample Client Applications SimplePublisher.cpp Example 6-3. SimplePublisher.cpp Sample Client Application (page 2 of 3) // Creating the Producer. pProducer = pSes->createProducer(destName); long long start = JULIANTIMESTAMP(); for (unsigned long count = 0; count < msgCount; count++) { strstream msg; // Setting Message msg<<"Publishing this message " << count << ends; cout << msg.str() << endl; // Creating Test Message pMsg = pSes->createTextMessage(); // Setting Text pMsg->setText (msg.
NSJMS C++ API Sample Client Applications SimpleConsumer.cpp Example 6-3. SimplePublisher.
NSJMS C++ API Sample Client Applications SimpleConsumer.cpp Example 6-4. SimpleConsumer.cpp Sample Client Application (page 1 of 3) /** * * Copyright (c) Hewlett-Packard Company, 2002-2003 * Protected as an unpublished work. * All rights reserved.
NSJMS C++ API Sample Client Applications SimpleConsumer.cpp Example 6-4. SimpleConsumer.cpp Sample Client Application (page 2 of 3) /* Create a new session using a properties file in the current working directory*/ /*********************************************** pSes = new Session("nsjms.properties"); ***********************************************/ // Creating the Consumer.
NSJMS C++ API Sample Client Applications SimpleConsumer.cpp Example 6-4. SimpleConsumer.cpp Sample Client Application (page 3 of 3) catch(exception & excp) { cout << excp.
7 Managing the NSJMS C++ API Environment The NSJMS C++ API shares the NSJMS environment, and the NSJMS administrative utility is used to manage the NSJMS and the NSJMS C++ API environments. The NSJMS administrative utility is documented in the NonStop Server for Java Message Service User’s Manual.
Managing the NSJMS C++ API Environment NSJMS Administrative Utility Commands and Attributes for the NSJMS C++ API NonStop Server for Java Message Service C++ API Programmer’s Guide—526459-002 7-2
8 Troubleshooting Recovering from SQL/MX Exceptions The SQL/MX exception condition messages listed below are retryable within the context of the NSJMS C++ API as shown in Recovering within Producer::send() Operations on page 8-1 and Recovering within Consumer::receive() Operations on page 8-2. SQL -8102 8102 The operation is prevented by a unique constraint. Cause. You attempted to perform an operation that is prevented by a unique constraint. This is sometimes referred to as a duplicate key error.
Troubleshooting Recovering within Consumer::receive() Operations break; } catch (NSJMS_Exception& sqle) { int sqlCode = sqle.getErrorCode(); if (sqle.getErrorCode() == DUPLICATE_ROW ) //-8102 { ABORTTRANSACTION(); continue; } if (sqle.getErrorCode() == RECORD_LOCK ) //73 { ABORTTRANSACTION(); DELAY(10); // wait .
Troubleshooting Debugging NSJMS C++ API Client Applications Debugging NSJMS C++ API Client Applications To debug an NSJMS C++ API client application, start an NSJMS C++ API client within an Inspect session by issuing the run -debug program_file_path [arguments] command. The operating system first starts the process in the hold state then starts the Inspect debugging tool, at which time you can set breakpoints and step through code statements.
Troubleshooting Logger.type debug—Logs messages useful during a debugging session. Setting Logger.loglevel to debug can substantially degrade performance and should be used only when requested by support personnel. A log level of debug displays all levels of messages: fatal, error, warning, info, and debug. Logger.type The Logger.type property uses these case-sensitive keywords to specify where to direct the output collected in the log file.
A Error Reporting and Messages This appendix provides information about JMS API error messages, the NSJMS C++ API logging facility, and the NSJMS C++ API exception types. JMS API Error Messages JMS API error messages and exceptions are described in the Sun Microsystems published specification, Java Message Service, Version 1.0.2. The specification is available on the Sun Microsystems Java Message Service (JMS) web site (http://java.sun.com/products/jms/docs.html)).
Error Reporting and Messages NSJMS_NoSuchProperty NSJMS_NoSuchProperty NSJMS_NoSuchProperty is thrown when a method attempts to read a non-existent property. NSJMS_InvalidConversion NSJMS_InvalidConversion is thrown when a get method attempts to read a property using an access type which does not match the property type. NSJMS_SQLError NSJMS_SQLError is thrown when a SQL error is returned by the method. The SQLCODE may be retrieved using the getErrorCode() method.
Glossary API. See application program interface (API). application program. One of the following: A software program written for or by a user for a specific purpose. A computer program that performs a data processing function rather than a control function. application program interface (API). A set of functions or procedures that are called by an application program to communicate with other software components. attribute.
Glossary interface interface. In general, the point of communication or interconnection between one person, program, or device and another, or a set of rules for that interaction. See also application program interface (API). Java Message Service (JMS). A Java API that enables client applications to create, send, receive, and read messages. See also NonStop Server for Java Message Service (NSJMS) C++ API. JMS. See Java Message Service (JMS). JMS client.
Glossary queue queue. A destination for a message in a PTP messaging system. scalability. The ability to increase the size and processing power of an online transaction processing system by adding processors and devices to a system, systems to a network, and so on, and to do so easily and transparently without bringing systems down. Sometimes called expandability. session. A context for JMS clients to send and receive messages. shell.
Glossary Transaction Management Facility (TMF) NonStop Server for Java Message Service C++ API Programmer’s Guide—526459-002 Glossary-4
Index A administrative utility applicable NSJMS C++ API commands 7-1 tracing client applications 8-3 B building client applications compiling user written C++ programs 5-13 description of 5-12 linking user written C++ programs 5-14 running user written C++ programs 5-15 BytesMessage class 4-2 developing client applications creating a session 5-3 description of 5-2 populating a message with data 5-3 receiving a message 5-9 retrieving data from a message 5-11 sending a message 5-5 directory structure 2-8, 3
Index N managing transactions 5-2 MapMessage class 4-2 message delivery mode 5-7 expiration value 5-7 priority 5-7 removal from a queue 5-8 removal from a topic 5-8 Message class description of 4-3 message body 5-5 message header 5-4 message properties 5-4 messaging models PTP 6-1 Pub/Sub 6-8 N NonStop SQL/MX 1-2 NSJMS administrative utility 7-1 properties file 2-9, 3-9 NSJMS C++ API Library 1-2 O ObjectMessage class 4-4 P Producer class 4-5, 5-6 properties file 2-9, 3-9 PTP messaging application 6-1 P