Tib Ems Dotnet Ref
Tib Ems Dotnet Ref
Service™
.NET Reference
Software Release 4.4
November 2006
Important Information
SOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH
EMBEDDED OR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE THE FUNCTIONALITY
(OR PROVIDE LIMITED ADD-ON FUNCTIONALITY) OF THE LICENSED TIBCO SOFTWARE.
THE EMBEDDED OR BUNDLED SOFTWARE IS NOT LICENSED TO BE USED OR ACCESSED BY
ANY OTHER TIBCO SOFTWARE OR FOR ANY OTHER PURPOSE.
USE OF TIBCO SOFTWARE AND THIS DOCUMENT IS SUBJECT TO THE TERMS AND
CONDITIONS OF A LICENSE AGREEMENT FOUND IN EITHER A SEPARATELY EXECUTED
SOFTWARE LICENSE AGREEMENT, OR, IF THERE IS NO SUCH SEPARATE AGREEMENT,
THE CLICKWRAP END USER LICENSE AGREEMENT WHICH IS DISPLAYED DURING
DOWNLOAD OR INSTALLATION OF THE SOFTWARE (AND WHICH IS DUPLICATED IN THE
TIBCO Enterprise Message Service User’s Guide). USE OF THIS DOCUMENT IS SUBJECT TO THOSE
TERMS AND CONDITIONS, AND YOUR USE HEREOF SHALL CONSTITUTE ACCEPTANCE
OF AND AN AGREEMENT TO BE BOUND BY THE SAME.
This document contains confidential information that is subject to U.S. and international copyright
laws and treaties. No part of this document may be reproduced in any form without the written
authorization of TIBCO Software Inc.
TIB, TIBCO, Information Bus, The Power of Now, TIBCO Adapter, Rendezvous are either registered
trademarks or trademarks of TIBCO Software Inc. in the United States and/or other countries.
EJB, J2EE, JMS and all Java-based trademarks and logos are trademarks or registered trademarks of
Sun Microsystems, Inc. in the U.S. and other countries.
All other product and company names and marks mentioned in this document are the property of
their respective owners and are mentioned for identification purposes only.
THIS SOFTWARE MAY BE AVAILABLE ON MULTIPLE OPERATING SYSTEMS. HOWEVER,
NOT ALL OPERATING SYSTEM PLATFORMS FOR A SPECIFIC SOFTWARE VERSION ARE
RELEASED AT THE SAME TIME. PLEASE SEE THE README.TXT FILE FOR THE
AVAILABILITY OF THIS SOFTWARE VERSION ON A SPECIFIC OPERATING SYSTEM
PLATFORM.
THIS DOCUMENT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
THIS DOCUMENT COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL
ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE
CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THIS DOCUMENT. TIBCO
SOFTWARE INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S)
AND/OR THE PROGRAM(S) DESCRIBED IN THIS DOCUMENT AT ANY TIME.
THE CONTENTS OF THIS DOCUMENT MAY BE MODIFIED AND/OR QUALIFIED, DIRECTLY
OR INDIRECTLY, BY OTHER DOCUMENTATION WHICH ACCOMPANIES THIS SOFTWARE,
INCLUDING BUT NOT LIMITED TO ANY RELEASE NOTES AND "READ ME" FILES.
Copyright © 2001–2006 TIBCO Software Inc. ALL RIGHTS RESERVED.
TIBCO Software Inc. Confidential Information
| iii
Contents
Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
TIBCO Enterprise Message Service Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
Other TIBCO Product Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
Third Party Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
How to Contact TIBCO Customer Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Chapter 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Excluded Features and Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Object Serialization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Strings and Character Encodings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
.NET Compact Framework (CF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Chapter 2 Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Parts of a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Body Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Setting Message Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
EMS Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
JMS Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Message Selectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Data Type Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Message.Acknowledge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Message.ClearBody . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Message.ClearProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Message.Clone. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Message.GetDeliveryModeName. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Message.Get Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Chapter 3 Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Destination Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
TemporaryQueue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
TemporaryQueue.Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
TemporaryTopic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Chapter 4 Consumer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
MessageConsumer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
MessageConsumer.Close. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
MessageConsumer.Receive. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
MessageConsumer.ReceiveNoWait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
QueueReceiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
TopicSubscriber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
EMSMessageHandler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
EMSMessageEventArgs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
EMSMessageEventArgs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
IMessageListener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
IMessageListener.OnMessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Chapter 5 Producer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
MessageProducer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
MessageProducer.Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
MessageProducer.Send . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
QueueSender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
QueueSender.Send . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
TopicPublisher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
TopicPublisher.Publish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Tables
Preface
TIBCO Enterprise Message Service™ software lets application programs send and
receive messages according to the Java Message Service (JMS) protocol. It also
integrates with TIBCO Rendezvous and TIBCO SmartSockets message products.
Topics
Related Documentation
Typographical Conventions
Convention Use
code font Code font identifies commands, code examples, filenames, pathnames, and
output displayed in a command window. For example:
Use MyCommand to start the TIBCO foo process.
• In large code samples, to indicate the parts of the sample that are of
particular interest.
• In command syntax, to indicate the default value.
Convention Use
Key Key name separated by a plus sign indicate keys pressed simultaneously. For
combinations example: Ctrl+C.
Key names separated by a comma and space indicate keys pressed one after the
other. For example: Esc, Ctrl+Q.
Convention Use
[ ] An optional item in a command or code syntax.
For example:
MyCommand [optional_parameter] required_parameter
| A logical ’OR’ that separates multiple items of which only one may be chosen.
For example, you can select only one of the following parameters:
MyCommand para1 | param2 | param3
{ } A logical group of items. Other syntax notations may appear within each logical
group.
For example, the following command requires two parameters, which can be
either param1 and param2 or param3 and param4:
MyCommand {param1 param2} | {param3 param4}
In the next example, the command requires two parameters. The first parameter
can be either param1 or param2 and the second can be either param3 or param4:
MyCommand {param1 | param2} {param3 | param4}
In the next example, the command can accept either two or three parameters.
The first parameter must be param1. You can optionally include param2 as the
second parameter. And the last parameter is either param3 or param4.
MyCommand param1 [param2] {param3 | param4}
For comments or problems with this manual or the software it addresses, please
contact TIBCO Support Services as follows.
• For an overview of TIBCO Support Services, and information about getting
started with TIBCO Product Support, visit this site:
http://www.tibco.com/services/support/default.jsp
• If you already have a valid maintenance or support contract, visit this site:
http://support.tibco.com
Entry to this site requires a username and password. If you do not have a
username, you can request one.
Chapter 1 Introduction
Topics
• Overview, page 2
• Excluded Features and Restrictions, page 3
• Strings and Character Encodings, page 4
• .NET Compact Framework (CF), page 5
Overview
TIBCO Enterprise Message Service .NET API implements (and extends) the JMS
1.1 specification. It is compatible with the JMS 1.0.2 specification.
This implementation consists of fully-managed .NET code.
TIBCO Enterprise Message Service .NET API closely mimics the Java API. This
parallelism eases porting of programs between the two programming languages.
The .NET API incorporates .NET-style event handling and enumerated constants
(to enable compiler type checking). These features encourage programmers to use
a .NET idiom, even while their Java-oriented versions remain available for quick
porting.
EMS .NET Compact Framework API brings the power of EMS to any hand-held
device or embedded system that supports .NET Compact Framework.
This section summarizes features that are not available in either the .NET library,
or the .NET Compact Framework library.
.NET
Feature .NET Compact
Framework
XA protocols for external transaction managers — —
Compression Yes —
SSL Yes —
Object Serialization
The .NET library supports serialization for all objects. In contrast, the .NET
Compact Framework library supports serialization for a restricted set of objects.
For details, see ObjectMessage on page 48.
Object serialization differs among the various EMS language APIs in ways that
are incompatible. An ObjectMessage contains a serialized object. Therefore EMS
programs can only send an ObjectMessage to another program written in the
same language; for example, Java to Java, C to C, .NET to .NET, and .NET
Compact Framework to .NET Compact Framework. In particular, notice that a
.NET Compact Framework client and a full .NET client cannot exchange an
ObjectMessage.
.NET programs represent strings within messages as byte arrays. Before sending
an outbound message, EMS programs translate strings to their byte
representation using an encoding, which the program specifies. Conversely, when
EMS programs receive inbound messages, they reconstruct strings from byte
arrays using the same encoding.
When a program specifies an encoding, it applies to all strings in message bodies
(names and values), and properties (names and values). It does not apply to
header names nor values. The method BytesMessage.WriteUTF always uses
UTF-8 as its encoding.
For a list of standard encoding names, see www.iana.org.
Outbound Programs can determine the encoding of strings in outbound messages in three
Messages ways:
• Use the default global encoding—namely, UTF-8.
• Set a non-default global encoding (for all outbound messages) using
Tibems.SetEncoding on page 293.
Outbound An inbound message from another EMS client explicitly announces its encoding.
Messages A receiving client decodes the message using the proper encoding.
This section presents recommendations for using the EMS .NET Compact
Framework API to develop applications for handheld devices.
Threads .NET Compact Framework does not support background threads. To avoid
problems with threads, we recommend that programs release all EMS resources
before terminating. For example, close EMS connections when they are no longer
needed (see Connection.Close on page 121).
Clock Resolution Clock resolution affects the granularity of all time-related calls and parameters—
for example MessageConsumer.Receive(timeout), connect delays. On some
handheld devices, clock resolution is coarser than one might expect. Check the
resolution on your target device before selecting time values.
Chapter 2 Messages
Message objects carry application data between client program processes. This
chapter presents the structure of messages, JMS message selector syntax to specify
a subset of messages based on their property values, the message classes and their
methods.
Topics
Parts of a Message
Body Types
Headers
Headers associate a fixed set of header field names with values. Clients and
providers use headers to identify and route messages.
Programs can access headers as .NET properties of the message object.
Header Description
JMS Headers
These .NET properties correspond to message headers defined in the JMS specification.
Programs can get all supported message header properties (see Message.Get Property on page 28).
Programs can effectively set only three message header properties—ReplyTo, CorrelationID and
MsgType (see Message.Set Property on page 30). For all other header properties, the provider
ignores or overwrites values set by client programs.
Header Description
CorrelationIDAsBytes byte[] {get; set;}
The JMS specification describes this optional utility, but EMS does not
support it. Attempting to access this header results in
System.InvalidOperationException.
This header instructs the server concerning persistent storage for the
message.
Sending calls record the delivery mode for each message, based on
either a property of the producer (DeliveryMode on page 94), or on a
parameter to the sending call.
For values, see the class DeliveryMode on page 260.
This parallel .NET property accesses the same header using enumerated
values (instead of ordinary integers). We recommend it over the
ordinary integer-valued accessor, because it enables .NET to do stronger
type checking at compile time, which can enhance program reliability.
For values, see the class MessageDeliveryMode on page 264.
Header Description
Expiration long {get; set;}
Sending calls record the expiration time (in milliseconds) of the message
in this field:
• If the time-to-live is non-zero, the expiration is the sum of that
time-to-live and the sending client’s current time (GMT).
• If the time-to-live is zero, then expiration is also zero—indicating
that the message never expires.
The server discards a message when its expiration time has passed.
However, the JMS specification does not guarantee that clients do not
receive expired messages.
See TimeToLive on page 96.
Header Description
Priority int {get; set;}
Sending clients can set this header to request that recipients reply to the
message:
• When the value is a destination object, recipients can send replies to
that destination. Such a message is called a request.
• When the value is null, the sender does not expect a reply.
Header Description
Timestamp long {get; set;}
Properties
Properties associate an extensible set of property field names with values. The
EMS server uses properties to attach ancillary information to messages.
Client applications can also use properties—for example, to customize message
filtering; see Message Selectors on page 18.
EMS Properties
The JMS specification reserves the property name prefix JMS_vendor_name_ for
provider-specific properties (for EMS, this prefix is JMS_TIBCO_). Properties that
begin with this prefix refer to features of EMS; client programs may use these
properties to access those features, but not for communicating application-specific
information among client programs.
Property Description
JMS_TIBCO_CM_PUBLISHER Correspondent name of an RVCM sender for messages
imported from TIBCO Rendezvous.
JMS_TIBCO_DISABLE_SENDER Senders may set this property to prevent the EMS server
from including the sender name in the message when the
server sends it to consumers; see JMS_TIBCO_SENDER.
Property Description
JMS_TIBCO_IMPORTED When the EMS server imports a message from an
external message service (such as TIBCO Rendezvous or
TIBCO SmartSockets), it sets this property to true.
JMS_TIBCO_SENDER The EMS server fills this property with the user name
(string) of the client that sent the message. This feature
applies only when the sender_name property of the
message’s destination is non-null. The sender can disable
this feature (overriding the destination property
sender_name) by setting a non-null value for the
message property JMS_TIBCO_DISABLE_SENDER.
JMS Properties
The JMS specification reserves the property name prefix JMSX for properties
defined by JMS. Client programs may use these properties to access those
features, but not for communicating application-specific information among
client programs.
To determine the set of JMS properties that a connection supports, call the method
JMSXPropertyNames on page 125. For information about these properties, see the
JMS specification.
Message Selectors
A message selector is string that lets a client program specify a set of messages,
based on the values of message headers and properties. A selector matches a
message if, after substituting header and property values from the message into
the selector string, the string evaluates to true. Consumers can request that the
server deliver only those messages that match a selector.
The syntax of selectors is based on a subset of SQL92 conditional expression
syntax.
Identifiers
Identifiers can refer to the values of message headers and properties, but not to
the message body. Identifiers are case-sensitive.
Basic Syntax An identifier is a sequence of letters and digits, of any length, that begins with a
letter. As in Java, the set of letters includes _ (underscore) and $ (dollar).
Illegal Certain names are exceptions, which cannot be used as identifiers. In particular,
NULL, TRUE, FALSE, NOT, AND, OR, BETWEEN, LIKE, IN, IS, and ESCAPE are defined to
have special meaning in message selector syntax.
Value Identifiers refer either to message header names or property names. The type of
an identifier in a message selector corresponds to the type of the header or
property value. If an identifier refers to a header or property that does not exist in
a message, its value is NULL.
Literals
String Literal A string literal is enclosed in single quotes. To represent a single quote within a
literal, use two single quotes; for example, 'literal''s'. String literals use the
Unicode character encoding. String literals are case sensitive.
Exact Numeric An exact numeric literal is a numeric value without a decimal point, such as 57,
Literal -957, and +62; numbers in the range of long are supported.
Approximate An approximate numeric literal is a numeric value with a decimal point (such as
Numeric Literal 7., -95.7, and +6.2), or a numeric value in scientific notation (such as 7E3 and
-57.9E2); numbers in the range of double are supported. Approximate literals
use the floating-point literal syntax of the Java programming language.
Boolean Literal The boolean literals are TRUE and FALSE (case insensitive).
Expressions
Arithmetic Arithmetic expressions are composed of numeric literals, identifiers (that evaluate
Expression to numeric literals), arithmetic operations, and smaller arithmetic expressions.
Operators
Comparison Comparison operators: =, >, >=, <, <=, <> (not equal).
Operators
These operators can compare only values of comparable types. (Exact numeric
values and approximate numerical values are comparable types.) Attempting to
compare incomparable types yields false. If either value in a comparison
evaluates to NULL, then the result is unknown (in SQL 3-valued logic).
Comparison of string values is restricted to = and <>. Two strings are equal if and
only if they contain the same sequence of characters.
Comparison of boolean values is restricted to = and <>.
White Space
White space is any of the characters space, horizontal tab, form feed, or line
terminator—or any contiguous run of characters in this set.
bool byte short char int long float double string byte[]
bool X X
byte X X X X X
short X X X X
char X X
int X X X
long X X
float X X X
double X X
string X X X X X X X X
byte[] X
Message
Class
Field Description
Constants defined as .NET fields.
DEFAULT_PRIORITY int 4
DEFAULT_TIME_TO_LIVE long 0
Header
CorrelationID
CorrelationIDAsBytes
DeliveryMode
MsgDeliveryMode
Destination
Expiration
MessageID
MsgType
Priority
Redelivered
ReplyTo
Timestamp
Message.Acknowledge
Method
Remarks The behavior of this call depends on the acknowledgement mode of the Session.
• In ClientAcknowledge mode, this call acknowledges all messages that the
program has consumed within the session. (This behavior complies with the
JMS specification.)
• In ExplicitClientAcknowledge mode, this call acknowledges only the
individual message. (This mode and behavior are proprietary extensions,
specific to TIBCO EMS.)
• In ExplicitClientDupsOkAcknowledge mode, this call lazily acknowledges
only the individual message. Lazy means that the provider client library can
delay transferring the acknowledgement to the server until a convenient time;
meanwhile the server might redeliver the message. (This mode and behavior
are proprietary extensions, specific to TIBCO EMS.)
• In all other modes, this call has no effect. In particular, modes that specify
transactions or implicit acknowledgement do not require the consuming
program to call this method. However, calling it does not produce an
exception. (This behavior complies with the JMS specification.)
Consumed Three events mark a message as consumed—that is, eligible for acknowledgment
using this method:
• Just before the provider raises an EMSMessageHandler event, it marks the
message argument as consumed.
• Just before the provider calls an IMessageListener.OnMessage callback, it
marks the message argument as consumed.
• Just before a receive call returns a message, it marks that message as
consumed.
Message.ClearBody
Method
Remarks Clearing the body of a message leaves its header and property values unchanged.
If the message body was read-only, this method makes it writable. The message
body appears and behaves identically to an empty body in a newly created
message.
Message.ClearProperties
Method
Remarks Clearing the property values of a message leaves its header values and body
unchanged.
Message.Clone
Method
Implements ICloneable.Clone
Message.GetDeliveryModeName
Method
Remarks Programs can obtain the delivery mode of a message by accessing the
DeliveryMode header property of the message object.
Message.Get Property
Method
Remarks The JMS specification defines eight methods to get properties with different value
types—converting between compatible types. It also defines a ninth method to
get values of the eight primitive types as if they were objects. All nine of these
methods convert property values to the corresponding type (if possible).
When the message does not have a property set for the name, these rules apply:
• GetStringProperty and GetObjectProperty return null.
• GetBooleanProperty returns false.
• Numeric methods throw EMSException.
Message.PropertyExists
Method
Remarks This call returns true if the property has a value on the message; otherwise it
returns false.
Message.Set Property
Method
Remarks The JMS specification defines eight methods to set properties with different
primitive value types. It also defines a ninth method to set a property to an object
representation of any of the eight primitive types.
Message.ToString
Method
Remarks The string includes the body type, headers (name-value pairs), properties
(name-value pairs), and body content.
BytesMessage
Class
Remarks Messages with this body type contain a single value, which is a byte stream.
BytesMessage.Read Read primitive data types from the byte stream in the 34
message body.
BytesMessage.ReadBytes Read bytes to a byte array from the byte stream in the 36
message body.
BytesMessage.WriteBytes Write bytes from a byte array to the byte stream in the 39
message body.
Member Description
Properties
Programs can get the length of the message body (in bytes). Programs
cannot set this .NET property.
BytesMessage
Constructor
BytesMessage.Read
Method
Purpose Read primitive data types from the byte stream in the message body.
Remarks The JMS specification defines these eleven methods to extract data from the byte
stream of a BytesMessage.
Each call reads a unit of data from the stream, and advances the read position so
that the next read call gets the next datum.
Parameter Description
value The method reads a datum from the message, and stores it in
this location.
length ReadUTF reads a UTF-8 string. Since the length of the string
cannot be determined in advance, the method stores the actual
length of the string in this location.
ReadByte 1 sbyte
ReadUnsignedByte 1 byte
ReadShort 2 short
ReadUnsignedShort 2 ushort
ReadChar 2 char
ReadLong 8 long
ReadFloat 4 float
ReadDouble 8 double
Encoded as UTF-8
BytesMessage.ReadBytes
Method
Purpose Read bytes to a byte array from the byte stream in the message body.
length Read (at most) this number of bytes from the stream.
When present, the length argument must be between zero and
value.length (inclusive); otherwise the call throws a
System.IndexOutOfRangeException (and does not read any
bytes).
Remarks Each call reads bytes from the stream into the byte array, and advances the read
position.
When the program supplies a length argument, the call attempts to read length
bytes; otherwise it attempts to read value.length bytes.
Returns This call returns the actual number of bytes read. When the call cannot read even
one byte, it returns -1.
BytesMessage.Write
Method
Purpose Write primitive data types to the byte stream in the message body.
Parameter Description
value Write this value to the message.
Remarks The JMS specification defines these ten methods to insert data into the byte
stream of a BytesMessage.
Each call writes a data value to the stream, and advances the write position so that
the next write call appends to the new end of the stream.
WriteByte 1
WriteShort 2
WriteChar 2
WriteInt 4
WriteLong 8
WriteFloat 4
WriteDouble 8
BytesMessage.WriteBytes
Method
Purpose Write bytes from a byte array to the byte stream in the message body.
offset Begin with the byte at this offset within the byte array.
Remarks Each call writes bytes from the byte array into the stream, and advances the write
position.
When the program supplies offset and length arguments, the call attempts to
write the specified bytes to the stream; otherwise it attempts to write the entire
byte array.
Offset & Length When present, the offset and length arguments must conform to these
restrictions:
• offset must be in the range [0, value.length-1]
That is, these two arguments must specify a span of bytes within the value
argument. Otherwise the call throws a System.IndexOutOfRangeException
(and does not write any bytes).
BytesMessage.Reset
Method
Purpose Set the read position to the beginning of the byte stream, and mark the message
body as read-only.
Remarks Reset prepares a message body for reading, as if the message were newly
received. Contrast Message.ClearBody on page 26, which clears a message body
in preparation for writing, as if it were newly created.
MapMessage
Class
Remarks Messages with this body type contain several values, indexed by name.
Member Description
Properties
Programs can get the number of data items in the message body.
Programs cannot set this .NET property.
Programs can get an enumerator that produces the names of all the data
items in the message body.
Extensions TIBCO Enterprise Message Service extends the JMS MapMessage and
StreamMessage body types in two ways. These extensions allow TIBCO
Enterprise Message Service to exchange messages with TIBCO Rendezvous and
TIBCO SmartSockets programs, which have certain features not available within
the JMS specification.
• You can insert another MapMessage or StreamMessage instance as a
submessage into a MapMessage or StreamMessage, generating a series of
nested messages, instead of a flat message.
• You can use arrays as well as primitive types for the values.
These extensions add considerable flexibility to the two body types. However,
they are extensions and therefore not compliant with JMS specifications.
Extended messages are tagged as extensions with the vendor property tag
JMS_TIBCO_MSG_EXT.
MapMessage
Constructor
MapMessage.Get
Method
Remarks The JMS specification defines eleven methods to extract data from the name-value
pairs of a MapMessage. Ten of these methods extract primitive data values. The
GetObject method gets these values as if they were objects.
Returns Each call finds the named pair (if it exists) and returns its value.
When the message does not have a field set for the name, these calls return null.
MapMessage.ItemExists
Method
MapMessage.Set
Method
Remarks The JMS specification defines eleven methods to set name-value pairs in a
MapMessage (these ten, plus MapMessage.SetBytes on page 47).
The first nine of these methods set pairs with primitive value types. The
SetObject method first converts an object to a primitive type (if possible), and
then places that value in the pair.
MapMessage.SetBytes
Method
value Associate bytes from this byte array as the value of the name.
offset Begin with the byte at this offset within the byte array.
Remarks When the program supplies offset and length arguments, the call extracts the
specified bytes and uses them as the value; otherwise it uses the entire byte array.
When present, the offset and length arguments must be between zero and
value.length (inclusive), and their sum must also fall within the same range.
That is, these two arguments must specify a span of bytes within the value
argument. Otherwise the call throws an System.IndexOutOfRangeException
(and does not set any value).
ObjectMessage
Class
Member Description
Properties
.NET Object serialization differs among the various EMS language APIs in ways that
Compact are incompatible. An ObjectMessage contains a serialized object. Therefore EMS
Framework programs can only send an ObjectMessage to another program written in the
same language; for example, Java to Java, C to C, .NET to .NET, and .NET
Compact Framework to .NET Compact Framework. In particular, notice that a
.NET Compact Framework client and a full .NET client cannot exchange an
ObjectMessage.
Furthermore, the .NET Compact Framework supports only a limited set of objects
for TheObject in an ObjectMessage—namely, bool, int, long, short, double,
float, byte, bytes, char, string, short[], int[], long[], float[], double[],
MapMessage, StreamMessage, and program-defined classes that implement
IEMSSerialziable. Attempting to set the value to an unsupported object type
results in MessageFormatException. This restriction applies only to .NET
Compact Framework (the full .NET EMS API is exempt).
ObjectMessage
Constructor
public ObjectMessage(
Session session );
StreamMessage
Class
Remarks Each datum in the stream must be a primitive type, or an object representation of
a primitive type.
Member Description
Properties
Programs can get the number of data items in the message body.
Programs cannot set this property.
Extensions TIBCO Enterprise Message Service extends the MapMessage and StreamMessage
body types in two ways. These extensions allow TIBCO Enterprise Message
Service to exchange messages with TIBCO Rendezvous and ActiveEnterprise
formats that have certain features not available within the JMS specification.
StreamMessage
Constructor
StreamMessage.Read
Method
Remarks The JMS specification defines these methods to extract data from a
StreamMessage. (See also StreamMessage.ReadBytes on page 54.)
Each call reads a unit of data from the stream, and advances the read position so
that the next read call gets the next datum.
StreamMessage.ReadBytes
Method
Remarks Each call reads bytes from the stream into the byte array, and advances the read
position.
This call returns the actual number of bytes read. When the call cannot read even
one byte, it returns -1.
A program that calls this method must call it repeatedly until it returns -1,
indicating that the program has extracted the complete set of bytes. Only then
may the program call another read method.
StreamMessage.Reset
Method
Purpose Set the read position to the beginning of the stream, and mark the message body
as read-only.
Remarks Reset prepares a message body for reading, as if the message were newly
received. Contrast Message.ClearBody on page 26, which clears a message body
in preparation for writing, as if it were newly created.
StreamMessage.Write
Method
Remarks The JMS specification defines these methods to insert data into a StreamMessage.
(See also StreamMessage.WriteBytes on page 57.)
Each call writes a data value to the stream, and advances the write position so that
the next write call appends to the new end of the stream.
WriteObject converts an object to a primitive value (if possible), and writes that
value to the stream message.
Parameters
Parameter Description
value Write this datum.
StreamMessage.WriteBytes
Method
offset Begin with the byte at this offset within the byte array.
Remarks Each call writes bytes from the byte array into the stream, and advances the write
position.
When the program supplies offset and length arguments, the call attempts to
write the specified bytes to the stream; otherwise it attempts to write the entire
byte array.
When present, the offset and length arguments must be between zero and
value.length (inclusive), and their sum must also fall within the same range.
That is, these two arguments must specify a span of bytes within the value
argument. Otherwise the call throws an IndexOutOfRangeException (and does
not write any bytes).
TextMessage
Class
Member Description
Properties
TextMessage
Constructor
public ObjectMessage(
Session session );
TextMessage.ClearBody
Remarks Clearing the body of a text message leaves its header and property values
unchanged.
If the text message body was read-only, this method makes it writable. The
message body appears and behaves identically to an empty body in a newly
created message.
TextMessage.Clone
Implements ICloneable.Clone.
Message.EmptyEnum
Class
Remarks Messages with this body type contain a single value, which is a string.
Member Description
Properties
Implements IEnumerator.Current.
Trying to get the current object in enumerator will throw an
InvalidOperationException.
Message.EmptyEnum
Constructor
Declaration Message.EmptyEnum();
Message.EmptyEnum.MoveNext
Method
Message.EmptyEnum.Reset
Chapter 3 Destination
Topics
Destination Overview
Destination objects represent destinations within the EMS server—the queues and
topics to which programs send messages, and from which they receive messages.
Queues deliver each message to exactly one consumer. Topics deliver each
message to every subscriber. Queues and topics can be static, dynamic or
temporary.
Destination
Class
Remarks Administrators define destinations in the server. Client programs access them
using methods of LookupContext.
Programs do not create instances of this class; instead, they create instances of its
subclasses.
Queue
Class
Member Description
Properties
The lookup name of the queue object. Each queue has a name that is unique
among all queues.
Queue
Constructor
Declaration Queue(
string name);
Remarks This constructor creates only local objects (within the program). It does not
attempt to lookup the corresponding server object until the program creates a
MessageConsumer or a MessageProducer that uses the queue. That automatic
lookup can result in either of two outcomes:
• If lookup succeeds, it binds the local queue object to the server queue object.
• If lookup fails, the server creates a new dynamic queue.
Parameter Description
name Find or create a queue with this name.
TemporaryQueue
Class
TemporaryQueue.Delete
Method
Remarks When a client deletes a temporary queue, the server deletes any unconsumed
messages in the queue.
Throws If the client still has listeners or receivers for the queue, or is in the middle of a
Receive call, then Delete throws an EMSException.
TemporaryTopic
Class
TemporaryTopic.Delete
Method
Remarks When a client deletes a temporary topic, the server deletes any unconsumed
messages in the topic.
Throws If the client still has listeners or receivers for the topic, or is in the middle of a
Receive call, then Delete throws an EMSException.
Topic
Class
Member Description
Properties
The lookup name of the topic object. Each topic has a name that is unique
among all topics.
Topic
Constructor
Declaration Topic(
string name );
Remarks This constructor creates only local objects (within the program). It does not
attempt to lookup the corresponding server object until the program creates a
MessageConsumer or a MessageProducer that uses the topic. That automatic
lookup can result in either of two outcomes:
• If lookup succeeds, it binds the local topic object to the server topic object.
• If lookup fails, the server creates a new dynamic topic.
Parameter Description
name Find or create a topic with this name.
Chapter 4 Consumer
Topics
• MessageConsumer, page 80
• QueueReceiver, page 85
• TopicSubscriber, page 86
• EMSMessageHandler, page 87
• EMSMessageEventArgs, page 88
• IMessageListener, page 90
MessageConsumer
Class
Subclasses QueueReceiver
TopicSubscriber
Remarks Consumers can receive messages synchronously (using the Receive methods), or
asynchronously.
Consumers can receive messages asynchronously in either of two idioms.
Programmers may select either idiom—but not both (which would cause
duplicate message processing, with undefined behavior).
• MessageHandler events let programs receive messages in a .NET
programming idiom.
• In contrast, the MessageListener property mimics the way in which JMS
provides similar functionality in a Java programming idiom.
Member Description
Events
MessageHandler EMSMessageHandler
Properties
When a message arrives, the client library calls this listener’s onMessage
method with the message as its argument. The program implements the
message listener interface, and registers a message listener object by
setting this property. See Remarks, above.
Member Description
MessageSelector string {get;}
MessageConsumer.Close
Method
Remarks If a receive call or a message listener is in progress, then Close waits until that call
returns.
Message consumers rely on resources outside the client program. To reclaim these
resources in a timely manner, we recommend that client programs explicitly close
message consumer objects (rather than waiting for garbage collection).
MessageConsumer.Receive
Method
Message Receive(
long timeout );
Parameter Description
timeout When present, wait no longer than this interval (in
milliseconds) for a message to arrive. Zero is a special value,
which specifies no timeout (block indefinitely).
When absent, the default value is zero.
Remarks This method consumes the next message from the destination.
When the destination does not have any messages ready, this method blocks:
• If a message arrives at the destination, this call immediately returns that
message.
• If the (non-zero) timeout elapses before a message arrives, this call returns
null.
• If another thread closes the consumer, this call returns null.
When calling receive within a transaction, the consumer retains the message until
transaction commits.
MessageConsumer.ReceiveNoWait
Method
Remarks When the destination has at least one message ready, this method immediately
returns the next message.
When the destination does not have any messages ready, this method
immediately returns null.
When calling receive within a transaction, the consumer retains the message until
transaction commits.
QueueReceiver
Class
Remarks This class inherits almost all of its behavior from MessageConsumer. It adds only a
property, specializing the generic destination to a queue.
Member Description
Properties
TopicSubscriber
Class
Remarks This class inherits almost all of its behavior from MessageConsumer; it adds only
two properties.
Member Description
Properties
When true, the subscriber does not receive messages sent through
the same server connection (that is, the connection associated with
the subscriber).
Programs set this property when creating the subscriber, and
cannot subsequently change it.
EMSMessageHandler
Delegate
Remarks This delegate provides an asynchronous pathway for receiving messages. The
program implements this delegate, and registers it with a MessageConsumer.
When a message arrives, the client library raises an event. This delegate processes
the event, which presents the message.
EMSMessageHandler receives messages in a .NET programming idiom. In
contrast, IMessageListener mimics the way in which JMS provides similar
functionality in a Java programming idiom. Programmers may select either
idiom—but not both (which would cause duplicate message processing, with
undefined behavior).
Parameter Description
sender The MessageConsumer object that raised a message event.
Serialization In compliance with the JMS specification, sessions distribute messages to listeners
and event handler delegates in serial (non-concurrent) fashion.
EMSMessageEventArgs
Class
Member Description
Properties
EMSMessageEventArgs
Constructor
Declaration EMSMessageEventArgs(
Message msg );
Parameter Description
msg The new event encapsulates this message, and signals its arrival.
IMessageListener
Interface
Remarks This interface provides an asynchronous pathway for receiving messages. The
program implements this interface, and registers a message listener with a
MessageConsumer. When a message arrives, the client library calls the listener’s
onMessage method with the message as its argument.
Serialization In compliance with the JMS specification, sessions distribute messages to listeners
and event handler delegates in serial (non-concurrent) fashion.
Deprecated In earlier releases, clients could register listeners with sessions as well as
consumers. This practice is now deprecated—we recommend migrating existing
code to one of these two practices:
• Java Idiom Register listeners with consumers.
• .NET Idiom Register EMSMessageHandler delegates with consumers.
IMessageListener.OnMessage
Method
Parameter Description
message Process this message.
Chapter 5 Producer
Topics
• MessageProducer, page 94
• QueueSender, page 100
• TopicPublisher, page 103
MessageProducer
Class
Subclasses QueueSender
TopicPublisher
Remarks Clients use message producers to send messages. A message producer object can
store several parameters that affect the messages it sends.
This class lacks a constructor. Instead, clients create message producers using
methods of a Session object; subclasses (such as QueueSession and
TopicSession) each define methods to create corresponding producer
subclasses.
Member Description
Properties
Member Description
Destination Destination {get;}
Member Description
TimeToLive long {get; set;}
MessageProducer.Close
Method
Remarks Message producers rely on resources outside the client program. To reclaim these
resources in a timely manner, we recommend that client programs explicitly close
message producer objects (rather than waiting for garbage collection).
MessageProducer.Send
Method
Parameter Description
dest When present, the call sends the message to this destination (queue or topic).
When absent, the call sends the message to the producer’s default
destination. When the producer does not specify a default, the send call must
supply this parameter.
Parameter Description
deliveryMode When present, the call sends the message with this delivery mode.
This argument may be either an enumerated value (see
MessageDeliveryMode on page 264) or an integer (see DeliveryMode on
page 260). We recommend enumerated values, because they enable .NET to
do stronger type checking at compile time, which can enhance program
reliability.
When absent, the call sends the message with the producer’s default delivery
mode.
priority When present, the call sends the message with this priority.
Priority affects the order in which the server delivers messages to consumers
(higher values first). The JMS specification defines ten levels of priority value,
from zero (lowest priority) to 9 (highest priority). The specification suggests
that clients consider 0–4 as gradations of normal priority, and priorities 5–9 as
gradations of expedited priority.
When absent, the call sends the message with the producer’s default priority.
timeToLive When present, the call uses this value (in milliseconds) to compute the
message expiration.
• If the time-to-live is non-zero, the expiration is the sum of that time-to-live
and the sending client’s current time (GMT). This rule applies even within
sessions with transaction semantics—the timer begins with the send call,
not the commit call.
• If the time-to-live is zero, then expiration is also zero—indicating that the
message never expires.
When absent, the call uses the producer’s default value to compute
expiration.
Whenever your application uses non-zero values for message expiration or
time-to-live, you must ensure that clocks are synchronized among all the host
computers that send and receive messages. Synchronize clocks to a tolerance
that is a very small fraction of the smallest or time-to-live.
QueueSender
Class
Remarks This class extends MessageProducer on page 94. It overloads more send
methods, specializing the destination parameter to a queue.
Member Description
Properties
QueueSender.Send
Method
Remarks QueueSender inherits send methods from MessageProducer, and also defines
these methods, which specialize the destination parameter to a queue; see
MessageProducer.Send on page 98.
Parameter Description
queue When present, the call sends the message to this queue.
When absent, the call sends the message to the sender’s default queue. When
the sender does not specify a default, the send call must supply this
parameter (that is, it cannot use one of the inherited methods that omit this
parameter).
deliveryMode When present, the call sends the message with this delivery mode.
This argument may be either an enumerated value (see
MessageDeliveryMode on page 264) or an integer (see DeliveryMode on
page 260). We recommend enumerated values, because they enable .NET to
do stronger type checking at compile time, which can enhance program
reliability.
When absent, the call sends the message with the sender’s default delivery
mode.
Parameter Description
priority When present, the call sends the message with this priority.
Priority affects the order in which the server delivers messages to consumers
(higher values first). The JMS specification defines ten levels of priority value,
from zero (lowest priority) to 9 (highest priority). The specification suggests
that clients consider 0–4 as gradations of normal priority, and priorities 5–9 as
gradations of expedited priority.
When absent, the call sends the message with the sender’s default priority.
timeToLive When present, the call uses this value (in milliseconds) to compute the
message expiration.
• If the time-to-live is non-zero, the expiration is the sum of that time-to-live
and the sending client’s current time (GMT).
• If the time-to-live is zero, then expiration is also zero—indicating that the
message never expires.
When absent, the call uses the sender’s default value to compute expiration.
Whenever your application uses non-zero values for message expiration or
time-to-live, you must ensure that clocks are synchronized among all the host
computers that send and receive messages. Synchronize clocks to a tolerance
that is a very small fraction of the smallest or time-to-live.
TopicPublisher
Class
Remarks This class extends MessageProducer on page 94. It overloads more send
methods, specializing the destination parameter to a topic.
Member Description
Properties
TopicPublisher.Publish
Method
Remarks These methods are parallel to the send methods that TopicPublisher inherits
from MessageProducer, and they accomplish the same goal—sending messages.
Parameter Description
topic When present, the call sends the message to this topic.
When absent, the call sends the message to the publisher’s default topic.
When the publisher does not specify a default, the publish call must supply
this parameter.
Parameter Description
deliveryMode When present, the call sends the message with this delivery mode.
This argument may be either an enumerated value (see
MessageDeliveryMode on page 264) or an integer (see DeliveryMode on
page 260). We recommend enumerated values, because they enable .NET to
do stronger type checking at compile time, which can enhance program
reliability.
When absent, the call sends the message with the publisher’s default delivery
mode.
priority When present, the call sends the message with this priority.
Priority affects the order in which the server delivers messages to consumers
(higher values first). The JMS specification defines ten levels of priority value,
from zero (lowest priority) to 9 (highest priority). The specification suggests
that clients consider 0–4 as gradations of normal priority, and priorities 5–9 as
gradations of expedited priority.
When absent, the call sends the message with the publisher’s default priority.
timeToLive When present, the call uses this value (in milliseconds) to compute the
message expiration.
• If the time-to-live is non-zero, the expiration is the sum of that time-to-live
and the sending client’s current time (GMT).
• If the time-to-live is zero, then expiration is also zero—indicating that the
message never expires.
When absent, the call uses the publisher’s default value to compute
expiration.
Whenever your application uses non-zero values for message expiration or
time-to-live, you must ensure that clocks are synchronized among all the host
computers that send and receive messages. Synchronize clocks to a tolerance
that is a very small fraction of the smallest or time-to-live.
Chapter 6 Requestor
Topics
QueueRequestor
Class
QueueRequestor
Constructor
Declaration QueueRequestor (
QueueSession session,
Queue queue );
Parameter Description
session The requestor operates within this queue session.
This session must not use transaction semantics. Its delivery mode must be
either AutoAcknowledge or DupsOkAcknowledge.
The Close method also closes this session as a side effect.
queue The requestor sends request messages to this queue, and waits for replies on
the same queue.
You must create this queue using the queue session you supply as the first
argument.
QueueRequestor.Close
Method
Remarks This method also closes the requestor’s session as a side effect.
QueueRequestor.Request
Method
Purpose Send a request message; wait for a reply and return it.
Remarks The requestor receives only the first reply. It discards other replies that arrive
subsequently.
Parameter Description
message Send this request message.
TopicRequestor
Class
TopicRequestor
Constructor
Declaration TopicRequestor (
TopicSession session,
Topic topic );
Parameter Description
session The requestor operates within this topic session.
This session must not use transaction semantics. Its delivery mode must be
either AutoAcknowledge or DupsOkAcknowledge.
The Close method also closes this session as a side effect.
topic The requestor sends request messages to this topic, and waits for replies on
the same topic.
You must create this topic using the topic session you supply as the first
argument.
TopicRequestor.Close
Method
Remarks This method also closes the requestor’s session as a side effect.
TopicRequestor.Request
Method
Purpose Send a request message; wait for a reply and return it.
Remarks The requestor receives only the first reply. It discards other replies that arrive
subsequently.
Parameter Description
message Send this request message.
Chapter 7 Connection
Topics
Connection
Class
Remarks When a program first opens a connection, the connection is stopped—that is, it
does not deliver inbound messages. To begin the flow of inbound messages, the
program must explicitly call the Start method. (Outbound messages flow even
before calling Start.)
The EMS .NET API does not support the optional methods
createConnectionConsumer and createDurableConnectionConsumer.
Asynchronous When a program uses a connection to send messages, the send calls can detect
Exceptions problems with the connection, and notify the client program (synchronously) by
throwing exceptions.
However, when a program uses a connection only to receive messages, the client
cannot catch such exceptions. Instead, programs can handle such exceptions
asynchronously in one of two idioms. Programmers may select either idiom—but
not both (which would cause duplicate exception processing, with undefined
behavior).
• ExceptionHandler events detect this type of problem in a .NET
programming idiom.
• In contrast, the ExceptionListener property mimics the way in which JMS
provides similar functionality in a Java programming idiom.
Member Description
Events
ExceptionHandler EMSExceptionHandler
Member Description
Properties
This property holds the URL of the server at the other endpoint of the
connection. When the connection interacts with several servers in a
fault-tolerant arrangement, this property indicates the current active
server.
This property is true if the connection has been closed; otherwise false.
Member Description
MetaData ConnectionMetaData {get;}
Connection.Close
Method
Remarks Closing the connection is sufficient to reclaim all of its resources; you need not
separately close the sessions, producers, and consumers associated with the
connection.
Closing a connection deletes all temporary destinations associated with the
connection.
Blocking If any message listener or receive call associated with the connection is processing
a message when the program calls this method, all facilities of the connection and
its sessions remain available to those listeners until they return. In the meantime,
this method blocks until that processing completes—that is, until all message
listeners and receive calls have returned.
Transactions Closing a connection rolls back all open transactions in all sessions associated
with the connection.
Connection.CreateSession
Method
Remarks The new session uses the connection for all server communications.
Parameter Description
transacted When true, the new session has transaction semantics.
When false, it has non-transaction semantics.
Connection.Start
Method
Remarks When a connection is created, it is stopped. It does not deliver inbound messages
until the program calls this method to explicitly start it.
If the connection is not stopped, this call has no effect.
Outbound messages flow even before calling Start.
Connection.Stop
Method
Remarks This call temporarily stops the connection from delivering inbound messages. A
program can restart delivery by calling Connection.Start.
When a connection is created, it is stopped. It does not deliver inbound messages
until the program calls this method to explicitly start it.
If the connection is already stopped, this call has no effect.
Effect When this call returns, the connection has stopped delivery to all consumers
associated with the connection:
• Messages do not arrive to trigger asynchronous message handler events, nor
message listeners.
• Synchronous receive methods block. If their timeout intervals expire, they
return null.
Blocking If any message listener or receive call associated with the connection is processing
a message when the program calls this method, all facilities of the connection and
its sessions remain available to those listeners until they return. In the meantime,
this method blocks until that processing completes—that is, until all message
listeners and receive calls have returned.
However, the stopped connection prevents the client program from processing
any new messages.
ConnectionMetaData
Class
Remarks Programs can retrieve this object from a connection; see MetaData on page 120.
Member Description
Properties
QueueConnection
Class
QueueConnection.CreateQueueSession
Method
Remarks The new queue session uses the connection for all server communications.
Parameter Description
transacted When true, the new session has transaction semantics.
When false, it has non-transaction semantics.
TopicConnection
Class
TopicConnection.CreateTopicSession
Method
Remarks The new topic session uses the connection for all server communications.
Parameter Description
transacted When true, the new session has transaction semantics.
When false, it has non-transaction semantics.
EMSExceptionHandler
Delegate
Remarks When a program uses a connection to send messages, the send calls can detect
problems with the connection, and notify the client program by throwing
exceptions. However, when a program uses a connection only to receive
messages, the client cannot catch such exceptions.
This delegate provides an alternate pathway for alerting a client program of
connection problems. The program implements this delegate, and registers it with
the connection. When the client library detects a connection problem, it raises an
event. This delegate processes the event, which contains an exception that details
the problem.
EMSExceptionHandler detects this type of problem in a .NET programming
idiom. In contrast, IExceptionListener mimics the way in which JMS provides
similar functionality in a Java programming idiom. Programmers may select
either idiom—but not both (which would cause duplicate exception processing,
with undefined behavior).
Parameter Description
sender The problematic connection object.
EMSExceptionEventArgs
Class
Member Description
Properties
EMSExceptionEventArgs
Constructor
Declaration EMSExceptionEventArgs(
EMSException emse );
Parameter Description
emse The new event encapsulates this exception, and signals its arrival.
IExceptionListener
Interface
Remarks When a program uses a connection to send messages, the send calls can detect
problems with the connection, and notify the client program by throwing
exceptions. However, when a program uses a connection only to receive
messages, the client cannot catch such exceptions.
This interface provides an alternate pathway for alerting a client program of
connection problems. The program implements this interface, and registers an
exception listener with the connection object. When the client library detects a
connection problem, it calls the listener’s onException method with an exception
argument that details the problem.
IExceptionListener mimics the way in which JMS detects this type of problem
in a Java programming idiom. In contrast, EMSExceptionHandler provides
similar functionality in a .NET idiom. Programmers may select either idiom—but
not both (which would cause duplicate exception processing, with undefined
behavior).
IExceptionListener.OnException
Method
Parameter Description
exception Handle this exception.
Topics
ConnectionFactory
Class
Remarks Connection factories are administered objects. They support concurrent use.
Administrators define connection factories in a repository. Each connection
factory has administrative parameters that guide the creation of server
connections. Usage follows either of two models:
EMS Server You can use the EMS server as a name service provider—one tibemsd process
provides both the name repository and the message service. Administrators
define factories in the name repository. Client programs create connection factory
objects with the URL of the repository, and call the
ConnectionFactory.CreateConnection method. This method automatically
accesses the corresponding factory in the repository, and uses it to create a
connection to the message service.
Separate JNDI Administrators define factories in a JNDI repository. Client programs call
Repository LookupContext.Lookup to retrieve factories, and use them to create connections
to the server.
Member Description
Properties
When the connection factory balances the client load among several servers,
it uses this metric to determine the least loaded server, so the connection
factory can create a connection to it. For values, see
QueueConnectionFactory on page 161.
Administered Administered objects let administrators configure EMS behavior at the enterprise
Objects level. Administrators define these objects, and client programs use them. This
arrangement relieves program developers and end users of the responsibility for
correct configuration.
ConnectionFactory
Constructor
Declaration ConnectionFactory(
string serverUrl,
string clientId,
Hashtable properties );
ConnectionFactory(
string serverUrl,
string clientId );
ConnectionFactory(
string serverUrl );
ConnectionFactory();
Remarks When administrators define factories in the EMS server, these constructors
automatically access the corresponding objects in the repository.
Parameter Description
serverUrl The constructor contacts the EMS server at this URL, to access a factory.
If connecting a fault-tolerant client, specify two or more comma-separated
URLs, as described below inReconnect and Fault Tolerance.
clientId A client ID string lets the server associate a client-specific factory with each
client program. When present, the server supplies that factory to the client. If
a factory does not yet exist for the client, the server creates one, and stores it
for future use by that specific client.
properties When present, these properties govern the behavior of the connection objects
that a client-specific factory creates. For a list of properties, see
Connection-Related Fields (Constants) on page 265.
Reconnect and To enable reconnection behavior and fault tolerance, the serverURL parameter
Fault Tolerance must be a comma-separated list of two or more URLs. In a situation with only one
server, you may supply two copies of that server’s URL to enable client
reconnection (for example, tcp://localhost:7222,tcp://localhost:7222).
ConnectionFactory.Clone
Method
ConnectionFactory.CreateConnection
Method
Connection CreateConnection();
Parameter Description
userName The connection object presents this user identity to the server. This parameter
can be omitted if the server isn’t authenticating or authorizing users.
password The connection object authenticates the user identity with this password. This
parameter can be omitted if the server isn’t authenticating or authorizing
users.
ConnectionFactory.GetSSLProxyHost
Method
Purpose Get the SSL proxy host from this connection factory.
ConnectionFactory.GetSSLProxyPassword
Method
ConnectionFactory.GetSSLProxyPort
Method
Purpose Get the SSL proxy port from this connection factory.
ConnectionFactory.GetSSLProxyUser
Method
ConnectionFactory.SetCertificateStoreType
Method
Parameter Description
type The type of certificate store. Can be either EMSSSL_STORE_TYPE_SYSTEM or
EMSSSL_STORE_TYPE_FILE. See EMSSSLStoreType on page 257 for details.
ConnectionFactory.SetClientID
Method
Parameter Description
clientID Client ID.
ConnectionFactory.SetClientTracer
Method
Remarks Client tracing prints loaded certificates and information about the SSL handshake
errors and results.
Parameter Description
tracer The output stream to send the tracing information. Specify null as parameter
to disable client tracing.
ConnectionFactory.SetConnAttemptCount
Method
Remarks See Setting Connection Attempts, Timeout and Delay Parameters in the TIBCO
Enterprise Message Service User’s Guide for details.
Parameter Description
attempts Number of connection attempts.
ConnectionFactory.SetConnAttemptDelay
Method
Remarks See Setting Connection Attempts, Timeout and Delay Parameters in the TIBCO
Enterprise Message Service User’s Guide for details.
Parameter Description
delay Time (in milliseconds) of the delay between connection attempts.
ConnectionFactory.SetConnAttemptTimeout
Method
Remarks This timeout is per url and per connect_attempt. For example, to specify two
connect attempts for a given url, then for each attempt the client will wait for the
period specified by the connect attempt timeout for the connection to be
established. If no connection is established within that the specified timeframe,
the client connection attempt is terminated.
See Setting Connection Attempts, Timeout and Delay Parameters in the TIBCO
Enterprise Message Service User’s Guide for details.
Parameter Description
timeout Timeout (in milliseconds) for the connection.
ConnectionFactory.SetHostNameVerifier
Method
Parameter Description
verifier Host name verifier. Set to null to remove custom host name verifier.
See EMSSSLHostNameVerifier on page 255 for details.
ConnectionFactory.SetMetric
Method
Parameter Description
metric Load balance metric.
ConnectionFactory.SetReconnAttemptCount
Method
Remarks See Reconnect Timeout in the TIBCO Enterprise Message Service User’s Guide for
details.
Parameter Description
attempts Number of reconnection attempts.
ConnectionFactory.SetReconnAttemptDelay
Method
Parameter Description
attempts Time (in milliseconds) of the delay between reconnection attempts.
ConnectionFactory.SetReconnAttemptTimeout
Method
Remarks This timeout is per url and per reconnect_attempt. For example, to specify two
reconnect attempts for a given url, then for each attempt the client will wait for
the period specified by the reconnect attempt timeout for the connection to be
established. If no reconnection is established within that the specified timeframe,
the reconnection attempt is terminated.
Parameter Description
timeout Timeout (in milliseconds) for the reconnection attempt.
ConnectionFactory.SetServerUrl
Method
The server URL for a fault-tolerant configuration is a string with multiple URL's
that are comma separated.
For example:
tcp://localhost:7222,tcp://localhost:7224.
Parameter Description
serverUrl The server URL.
ConnectionFactory.SetSSLAuthOnly
Method
Remarks For the client and server to require an SSL connection only to perform
authentication, the ssl_auth_only parameter needs to be set on the server and
AUTH_ONLY needs to be set by the client. Setting these flags on both the server
and client side indicates that the SSL connection is only used to only perform
authentication. Once authentication is complete, the client switches to a regular
TCP connection to communicate with the server.
See the SSL Authentication Only section in the TIBCO Enterprise Message Service
User’s Guide for details.
Parameter Description
authOnly • When true, AUTH_ONLY is enabled.
• When false, (the default) AUTH_ONLY is disabled.
ConnectionFactory.SetSSLProxy
Method
Purpose Set the connection factory's parameters for connecting through an SSL proxy.
Remarks An SSL proxy lets an EMS application create an SSL connection to an EMS server,
even though a firewall separates the application from the server. The proxy
usually runs within the firewall's DMZ. A connection factory contacts the SSL
proxy, requesting an SSL connection to the server. The proxy authenticates the
application program, and mediates the initial SSL negotiation between
application and server. After the SSL connection is established, the application
and server use it to communicate directly with one another.
Parameter Description
host The connection factory establishes SSL communication through a web proxy at this
host. Supply a simple hostname, a fully qualified hostname with domain name, or
an IP address (dot notation).
port The connection factory establishes SSL communication through a web proxy on
this port.
Throws EMSException if the proxy host is null or empty, the port is zero or the protocol of
the connection factory's URL is not SSL.
ConnectionFactory.SetSSLProxyAuth
Method
Purpose Set a connection factory's username and password for connecting through an SSL
proxy.
Remarks When a connection factory establishes an EMS server connection through an SSL
proxy host, the proxy might first require authentication before facilitating a
connection. When required, use this call to set that authentication data on the
connection factory.
This proxy authentication data is distinct from the server authentication data, and
from the SSL private key encryption password.
Parameter Description
username The connection factory authenticates itself to the SSL proxy using this
username.
password The connection factory authenticates itself to the SSL proxy using this
password.
Throws EMSException if the protocol of the connection factory's URL is not SSL.
ConnectionFactory.SetSSLTrace
Method
Remarks Tracing will show information during the SSL handshake and on messages
received and sent by the SSL link.
Parameter Description
tracing • When true, tracing is enabled.
• When false, (the default) tracing is disabled.
ConnectionFactory.SetTargetHostName
Method
Remarks This is a required parameter for all .NET SSL connections. Because
System.Net.Security.SslStream requires a target host, this value is required.
Parameter Description
targetHostName The name of the server as defined in the server's certificate. Usually the
server's HostName is specified as the CN in the server's certificate.
ConnectionFactory.SetUserName
Method
Parameter Description
username User name.
ConnectionFactory.SetUserPassword
Method
Parameter Description
password Password.
QueueConnectionFactory
Class
QueueConnectionFactory.CreateQueueConnection
Method
QueueConnection CreateQueueConnection();
Remarks When the identity parameters are absent, the connection object presents a default
user identity. If the server configuration permits that user, then the call succeeds.
Parameter Description
userName When present, the connection object presents this user identity to the server.
password When present, the connection object authenticates the user identity with this
password.
QueueConnectionFactory.Clone
Method
Remarks Overrides the Clone process. Returns an object that is a clone of this
QueueConnectionFactory instance.
TopicConnectionFactory
Class
TopicConnectionFactory.CreateTopicConnection
Method
TopicConnection CreateTopicConnection();
Remarks When the identity parameters are absent, the connection object presents a default
user identity. If the server configuration permits that user, then the call succeeds.
Parameter Description
userName When present, the connection object presents this user identity to the server.
password When present, the connection object authenticates the user identity with this
password.
TopicConnectionFactory.Clone
Method
Remarks Overrides the Clone process. Returns an object that is a clone of this
TopicConnectionFactory instance.
FactoryLoadBalanceMetric
Class
Remarks When a connection factory balances the client load among several servers, it uses
this metric to determine the least loaded server, so the connection factory can
create a connection to it.
Member Description
Fields
Connections The connection factory balances the connection load among several servers by
creating a connection to the server with the fewest number of connections.
ByteRate The connection factory balances the connection load among several servers by
creating a connection to the server with the lowest total byte rate (input and
output).
Chapter 9 Session
Topics
Session
Class
Single Thread The JMS specification restricts programs to use each session within a single
thread.
Associated The same single-thread restriction applies to objects associated with a session—
Objects namely, messages, message consumers, durable subscribers, message producers,
queue browsers, and temporary destinations (however, static and dynamic
destinations are exempt from this restriction).
Corollary One consequence of this rule is that all the consumers of a session must deliver
messages in the same mode—either synchronously or asynchronously.
Close The only exception to the rule restricting session calls to a single thread is the
method Session.Close; programs can call Close from any thread at any time.
After these actions, both Commit and Rollback immediately begin a new
transaction.
Member Description
Properties
Member Description
Connection Connection {get;}
Session ID.
Transactions
Other
Field Description
SESSION_TRANSACTED int
Acknowledge Modes
AUTO_ACKNOWLEDGE int
CLIENT_ACKNOWLEDGE int
DUPS_OK_ACKNOWLEDGE int
EXPLICIT_CLIENT_ACKNOWLEDGE int
Field Description
EXPLICIT_CLIENT_DUPS_OK_ACKNOWLEDGE int
In EXPLICIT_CLIENT_DUPS_OK_ACKNOWLEDGE mode,
the client program lazily acknowledges only the
individual message, by calling
Message.Acknowledge on page 25. The client may
acknowledge messages in any order.
Lazy means that the provider client library can delay
transferring the acknowledgement to the server until
a convenient time; meanwhile the server might
redeliver the message.
This mode and behavior are proprietary extensions,
specific to TIBCO EMS.
NO_ACKNOWLEDGE int
Session.Close
Method
Remarks Closing a session automatically closes its consumers (except for durable
subscribers), producers and browsers.
Blocking If any message listener or receive call associated with the session is processing a
message when the program calls this method, all facilities of the connection and
its sessions remain available to those listeners until they return. In the meantime,
this method blocks until that processing completes—that is, until all message
listeners and receive calls have returned.
Transactions Closing a session rolls back the open transaction in the session.
Session.Commit
Method
Remarks A session (with transaction semantics) always has exactly one open transaction.
Message operations associated with the session become part of that transaction.
This call commits all the messages within the transaction, and releases any locks.
Then it opens a new transaction.
Session.CreateBrowser
Method
QueueBrowser CreateBrowser(
Queue queue );
Parameter Description
queue Browse this queue.
messageSelector When present, the browser presents only messages that match this selector;
see Message Selectors on page 18.
When absent, null, or the empty string, the browser views all messages in the
queue.
Session.CreateBytesMessage
Method
Session.CreateConsumer
Method
MessageConsumer CreateConsumer(
Destination dest,
string messageSelector );
MessageConsumer CreateConsumer(
Destination dest );
Parameter Description
dest Create a consumer for this destination. The argument may be any destination
(queue or topic).
messageSelector When present, the server filters messages using this selector, so the consumer
receives only matching messages; see Message Selectors on page 18.
When absent, null, or the empty string, the consumer receives messages
without filtering.
noLocal When true, the server filters messages so the consumer does not receive
messages that originate locally—that is, messages sent through the same
connection.
When absent or false, the consumer receives messages with local origin.
Session.CreateDurableSubscriber
Method
TopicSubscriber CreateDurableSubscriber(
Topic topic,
string name );
Parameter Description
topic Create a durable subscriber for this topic (which cannot be a
TemporaryTopic).
name This unique name lets the server associate the subscriber with a subscription.
messageSelector When present, the server filters messages using this selector, so the subscriber
receives only matching messages; see Message Selectors on page 18.
When absent, null, or the empty string, the subscriber receives messages
without filtering.
noLocal When true, the server filters messages so the subscriber does not receive
messages that originate locally—that is, messages sent through the same
connection.
When absent or false, the consumer receives messages with local origin.
Remarks The server associates a durable subscription with at most one subscriber object at
a time. When a subscriber object exists, the subscription is active, and the server
delivers messages to it; when no subscriber object exists, the subscription is
inactive.
Durable subscriptions guarantee message delivery across periods during which
the subscriber is inactive. The server retains unacknowledged messages until the
subscriber acknowledges them, or until the messages expire.
Subscription Continuity across inactive periods uses two data items from the client:
Continuity
• Subscription Name a parameter of this method
• Client ID an optional property of the Connection (used only when supplied)
The server uses one or both of these two items to match a subscriber object with
its subscription. If a matching subscription exists, and it is inactive, then the
server associates it with the subscriber (and the subscription becomes active). The
server delivers unacknowledged messages to the subscriber.
If a matching subscription exists, but it is already active, this method throws
EMSException.
If a matching subscription to the topic does not yet exist, the server creates one.
Changing Topic Notice that the server does not use the topic and message selector arguments to
or Selector match a subscriber to an existing subscription. As a result, client programs can
change a subscription by altering either or both of these arguments. The effect is
equivalent to deleting the existing subscription (from the server) and creating a
new one (albeit with the same client ID and subscription name).
Session.CreateMapMessage
Method
Session.CreateObjectMessage
Method
ObjectMessage CreateObjectMessage();
Parameter Description
obj When present, use this object as data in the new message.
Session.CreateProducer
Method
Parameter Description
dest When non-null, the producer sends messages to this destination.
When null, the client program must specify the destination for each message
individually.
Session.CreateQueue
Method
Remarks If the named queue already exists at the server, then this method returns that
queue. (That queue can be either static or dynamic.)
If the named queue does not yet exist at the server, and the server allows dynamic
queues, then this method creates a dynamic queue.
Dynamic destinations are provider-specific, so programs that use them might not
be portable to other providers.
Parameter Description
queueName Get or create the queue with this name.
Session.CreateStreamMessage
Method
Session.CreateTemporaryQueue
Method
Remarks A temporary queue lasts no longer than the connection. That is, when the
connection is closed or broken, the server deletes temporary queues associated
with the connection.
Session.CreateTemporaryTopic
Method
Remarks A temporary topic lasts no longer than the connection. That is, when the
connection is closed or broken, the server deletes temporary topic associated with
the connection.
Session.CreateTextMessage
Method
TextMessage CreateTextMessage();
Parameter Description
text When present, use this string as data in the new message.
Session.CreateTopic
Method
Remarks If the named topic already exists at the server, then this method returns that topic.
(That topic can be either static or dynamic.)
If the named topic does not yet exist at the server, and the server allows dynamic
topics, then this method creates a dynamic topic.
Dynamic destinations are provider-specific, so programs that use them might not
be portable to other providers.
Parameter Description
topicName Get or create the topic with this name.
Session.Recover
Method
Operation This method requests that the server do this sequence of actions:
1. Stop message delivery within the session.
2. Mark as redelivered, any messages that the server has attempted to deliver to
the session, but for which it has not received acknowledgement (that is,
messages for which processing state is ambiguous).
According to the JMS specification, the server need not redeliver messages in
the same order as it first delivered them.
3. Restart message delivery (including messages marked as redelivered in step 2).
Session.Rollback
Method
Remarks When a session does not have transactional semantics, this method throws
IllegalStateException.
Session.Run
Method
Session.Unsubscribe
Method
Parameter Description
name This name lets the server locate the subscription.
QueueSession
Class
TopicSession
Class
SessionMode
Enumeration
Members Description
SessionTransacted The IsTransacted property has this value if the
session uses transaction semantics.
Acknowledge Modes
Members Description
ExplicitClientDupsOkAcknowledge In this mode, the client program lazily acknowledges
only the individual message, by calling
Message.Acknowledge on page 25. The client may
acknowledge messages in any order.
Lazy means that the provider client library can delay
transferring the acknowledgement to the server until
a convenient time; meanwhile the server might
redeliver the message.
This mode and behavior are proprietary extensions,
specific to TIBCO EMS.
Queue browsers let client programs examine the messages on a queue without
removing them from the queue.
Topics
QueueBrowser
Class
Remarks A browser is a dynamic enumerator of the queue (not a static snapshot). The
queue is at the server, and its contents change as message arrive and consumers
remove them. Meanwhile, while the browser is at the client. The method
QueueBrowser.MoveNext asks the server for the next message after Current—
that is, the next message that is still in the queue.
The browser can enumerate messages in a queue, or a subset filtered by a message
selector.
Sessions serve as factories for queue browsers; see Session.CreateBrowser on
page 178.
Member Description
Properties
The browser’s message selector expression filters the messages that the
browser presents.
QueueBrowser.Reset Reset the browser to the location before the first 207
message.
QueueBrowser.Close
Method
QueueBrowser.GetEnumerator
Method
Remarks This method returns the browser object—which is itself the enumerator.
QueueBrowser.MoveNext
Method
Remarks A browser is a dynamic enumerator of the queue (not a static snapshot). The
queue is at the server, and its contents change as message arrive and consumers
remove them. Meanwhile, while the browser is at the client. This method asks the
server for the next message after Current—that is, the next message that is still in
the queue.
Returns true if another message exists; the Current property subsequently
presents the next message.
Returns false otherwise.
After creating a browser, programs must first call this method to examine the first
message.
QueueBrowser.Reset
Method
Purpose Reset the browser to the location before the first message.
Lookup context objects find named objects (such as connection factories and
destinations) in the name repository. (The EMS server, tibemsd, provides the
name repository service).
Topics
ILookupContext
Interface
Purpose The initial context used to look up administered objects in either an EMS server or
a third-party LDAP server.
Member Description
Settings System.Collections.Hashtable Settings {get;}
ILookupContext.AddSettings
Method
Remarks You can add settings to the lookup context by either passing a hash table or a
property/value pair.
Setting added to the lookup context are mainly LDAP or TIBCO EMS Naming
Server related parameters used for looking up objects stored in an LDAP server or
TIBCO EMS Server. Examples of setting names include LDAP_SERVER_URL or
LDAP_BASE_DN.
Parameter Description
propName Set this single property.
For property names, see Fields on page 215.
table Set all the name-value pairs contained in this hash table.
ILookupContext.Lookup
Method
Remarks This method looks up an object in either an LDAP or TIBCO EMS Naming server,
depending on which interface is asked for in the LookupContextFactory.
Parameter Description
name Name of the object to lookup.
ILookupContext.RemoveSettings
Method
Parameter Description
propName Name of the property to be removed from the lookup context.
Example Add and then remove the LDAP_SERVER_URL property from the lookup context:
Hashtable table = new Hashtable();
table.Add(LdapLookupConsts.LDAP_SERVER_URL,
"adc1.na.tibco.com:10389");
LookupContextFactory contextFactory = new LookupContextFactory();
ILookupContext searcher = contextFactory.CreateContext(
"ldap", table);
searcher.RemoveSettings(LdapLookupConsts.LDAP_SERVER_URL);
LookupContext
Class
Purpose Search for and perform queries on administered objects in the EMS server.
Remarks The context object establishes communication with the EMS server, authenticates
the user, and submits name queries.
The following is a list of properties used to connect to an EMS server and
specifying the search scope for looking up EMS administered objects. See
LdapLookupConsts on page 224 for the properties related to establishing a lookup
context for a third-party LDAP server.
Member Description
Properties
Fields
Programs use these constants as names of context settings (in argument hashtables or individually).
PROVIDER_URL string
SECURITY_CREDENTIALS string
SECURITY_PRINCIPAL string
URL_LIST string
Member Description
URL_SEPARATOR string
LookupContext
Constructor
Declaration LookupContext(
Hashtable prop );
LookupContext();
Remarks The first constructor sets properties of the new context object.
The second constructor creates a context without property settings.
Parameter Description
prop Set all the name-value pairs contained in this hash table.
LookupContext.AddSettings
Method
Remarks The first method sets one property. If the property was previously set, the method
modifies it and returns the old value.
The second method sets multiple properties defined in a hash table.
Parameter Description
propName Set this single property.
For property names, see Fields on page 215.
prop Set all the name-value pairs contained in this hash table.
LookupContext.Lookup
Method
Parameter Description
name Lookup this name.
LookupContext.RemoveSettings
Method
Parameter Description
propName Remove this property.
For property names, see Fields on page 215.
LookupContextFactory
Class
Remarks To lookup administered objects in either a third-party LDAP naming server or the
TIBCO EMS Naming server, clients create an instance of the
LookupContextFactory and invoke the
LookupContextFactory.CreateContext method to get an ILookupContext
object.
Member Description
Fields
Programs use these constants as names of context settings (in argument hashtables or individually).
LDAP_CONTEXT string
TIBJMS_NAMING_CONTEXT string
LookupContextFactory
Constructor
Declaration LookupContextFactory();
LookupContextFactory.CreateContext
Method
Purpose Returns the initial context used to search for administered objects
Remarks This method returns an ILookupContext object that is the initial context used to
look up administered object in the EMS server or an LDAP server. The currently
supported contexts are tibjmsnaming and ldap.
Parameter Description
name Can be either:
• LookupContextFactory.TIBJMS_NAMING_CONTEXT to create an initial
context in the EMS server.
• LookupContextFactory.LDAP_CONTEXT to create an initial context in an
LDAP server.
Before calling CreateContext, first create a hash table of properties and their
values.
Examples This example demonstrates how to create an initial context for looking up a queue
object in the EMS naming server:
Hashtable env = new Hashtable();
env.Add(LookupContext.PROVIDER_URL,
"tibjmsnaming://localhost:7222");
env.Add(LookupContext.SECURITY_PRINCIPAL", "myUserName");
env.Add(LookupContext.SECURITY_CREDENTIALS", "myPassword");
TIBCO.EMS.Queue queue =
(TIBCO.EMS.Queue)searcher.Lookup("theQueueName");
This example shows how to look up a connection factory object in the LDAP
server via SSL.
Hashtable props = new Hashtable();
props.Add(LdapLookupConsts.LDAP_SERVER_URL",
"adc1.na.tibco.com:10636");
props.Add(LdapLookupConsts.LDAP_BASE_DN",
"ou=People,dc=test-user");
props.Add(LdapLookupConsts.LDAP_PRINCIPAL", "cn=Manager");
props.Add(LdapLookupConsts.LDAP_CREDENTIAL", "password");
props.Add(LdapLookupConsts.LDAP_SEARCH_SCOPE, "subtree");
props.Add(LdapLookupConsts.LDAP_CONN_TYPE, "ldaps");
props.Add(LdapLookupConsts.LDAP_CERT_NAME, "certName");
props.Add(LdapLookupConsts.LDAP_CERT_STORE_NAME, "My");
props.Add(LdapLookupConsts.LDAP_CERT_STORE_LOCATION,
"currentuser");
LdapLookupConsts
Class
Purpose Specifies the parameters used to connect to a third-party LDAP server and lookup
EMS administered objects.
Remarks The LDAP Lookup Constants are mainly to specify parameters to connect to an
LDAP server and specify search scope with the LDAP server for looking up EMS
administered objects.
See LookupContext on page 215 for the parameters used looking up administered
objects in the EMS server.
Member Description
LDAP_BASE_DN Specifies the base DN, which is where to start looking for the
administered objects.
LDAP_CERT_STORE_NAME Specifies the store name. The default is "My" (i.e personal) store
at the "currentuser" location.
LDAP_CONN_TYPE Specifies the connection type. The acceptable values are "ldap"
(the default) and "ldaps".
LDAP_PRINCIPAL Specifies the principal (for example, the user name) to use while
connecting to the ldap server.
LDAP_SEARCH_SCOPE Specifies the search scope. The acceptable values are "subtree"
(the default) and "onelevel."
LDAP_SERVER_URL Specifies the url for the connection to the LDAP server.
Member Description
LDAP_SSL_PARAMS Specifies the other ssl parameters, namely
QueryClientCertificateCallback and
VerifyServerCertificateCallback.
LdapLookupContext
Class
Purpose Interface used to search for and perform queries on EMS administered objects in a
third-party LDAP server.
Member Description
Settings System.Collections.Hashtable Settings {get;}
LdapLookupContext.AddSettings
void AddSettings(
Hashtable prop );
Remarks The first method sets one property. If the property was previously set, the method
modifies it and returns the old value.
The second method sets multiple properties defined in a hash table.
Parameter Description
propName Set this single property.
For property names, see LdapLookupConsts on page 224.
prop Set all the name-value pairs contained in this hash table.
LdapLookupContext.Lookup
Parameter Description
name Lookup this name.
LdapLookupContext.RemoveSettings
Parameter Description
propName Remove this property.
For property names, see LdapLookupConsts on page 224.
LdapLookupSSLParams
Class
Purpose Provides the query client certificate callback and the server verify callback used to
establish an SSL connection to the LDAP server (ldaps).
Remarks The parameters set by this object are optional. The client may choose to either
specify the store location along with the store name and certificate name, or
optionally the query client certificate callback.
LdapLookupSSLParams
Constructor
Declaration LdapLookupSSLParams();
LdapLookupSSLParams.SetSSLQueryClientCertificateCallback
Purpose Set the query client certificate callback to be invoked during the SSL handshake
with the LDAP server.
Remarks A query client certificate callback that gets invoked during the ssl handshake with
the ldap server, allowing the user to specify a client certificate to be used for ssl
handshake.
Parameter Description
callback The query client certificate callback.
LdapLookupSSLParams.SetSSLVerifyServerCertificateCallback
Purpose Set the server certificate verify callback to be invoked during the SSL handshake
with the ldap server.
Remarks A server certificate verify callback if set gets invoked during the ssl handshake
with the ldap server. If this is not specified then the client will trust any server
Parameter Description
callback The server certificate verify callback.
Topics
EMSSSL
Class
Purpose Sets and gets the SSL parameters that apply across all connections.
SSL Parameters
A client has to choose the certificate store it is going to work with before setting
the SSL parameters. EMS .NET client supports two different certificate stores and
each store has a different API. See EMSSSLFileStoreInfo and
EMSSSLSystemStoreInfo for more information on the certificate store specific
APIs.
Cipher Suites
The .NET framework does not allow ciphers to be specified from the client side,
so there is no provision of specifying the ciphers in the API.
General Setup
When an EMS .NET client establishes an SSL connection to the EMS server, it
should at the very least specify the TARGET_HOST_NAME parameter, this is a
required parameter for the SSLStream. A client then has to specify one of the
certificate store types, EMSSSL_STORE_TYPE_FILE or
EMSSSL_STORE_TYPE_SYSTEM, along with the Store info object containing all the
required information:
• In case of the system store, the EMSSSLSystemStoreInfo object has
information about the location of the store, the store name and the certificate
name to look for in the store.
• In case of the file store, the EMSSSLFileStoreInfo object has information
about the client identity, the password for the private key and any optional
trusted certificates.
The client can set the host name verifier callback that will be called during the SSL
handshake, the client can perform any specific validations in the host name
verifier callback, returning false from this callback causes the SSL handshake to
terminate, return true causes the SSL handshake to proceed.
If the client is interested in authentication only, then it can call
EMSSSL.SetAuthOnly to enable. Normal behavior is to perform authentication
before any data that is sent/received encrypted/decrypted. Setting auth only on
both the client and server causes the client to use an SSL connection only to
perform authentication and the switch over to a TCP connection for better
performance at the expense of data security.
For complete details, see the corresponding item in the book TIBCO Enterprise
Message Service .NET Reference.
Member Description
AUTH_ONLY string AUTH_ONLY = "TIBCO.EMS.ssl.auth_only";
Name of SSL property specifying the client tracer object The is a valid
tracer object This name is defined as "TIBCO.EMS.ssl.client_trace".
Member Description
HOST_NAME_VERIFIER string HOST_NAME_VERIFIER =
"TIBCO.EMS.ssl.hostname_verifier";
Name of SSL property specifying the password for the private key or
the identity store. The value is a java.lang.String object or char[]. This
name is defined as "TIBCO.EMS.ssl.password".
TRACE
Member Description
TRUSTED_CERTIFICATES string TRUSTED_CERTIFICATES =
"TIBCO.EMS.ssl.trusted_certs";
EMSSSL.GetClientTracer Returns the output target for the client tracer, or 241
null if client tracing is disabled.
EMSSSL.SetCertificateStoreType Set the store type for all the connection factories. 243
EMSSSL.GetAuthOnly
Method
EMSSSL.GetClientTracer
Method
Purpose Returns the output target for the client tracer, or null if client tracing is disabled.
EMSSSL.GetHostNameVerifier
Method
EMSSSL.GetTargetHostName
Method
EMSSSL.Initialize
Method
Remarks Normally SSL environment is initialized automatically when creating the first SSL
connection. If SSL environment has been already initialized this method does
nothing.
EMSSSL.SetAuthOnly
Method
Remarks For the client and server to require an SSL connection only to perform
authentication, the ssl_auth_only parameter needs to be set on the server and
AUTH_ONLY needs to be set by the client. Setting these flags on both the server
and client side indicates that the SSL connection is only used to only perform
authentication. Once authentication is complete, the client switches to a regular
TCP connection to communicate with the server.
See the SSL Authentication Only section in the TIBCO Enterprise Message Service
User’s Guide for details.
Parameter Description
flag True = enabled.
False = disabled.
EMSSSL.SetCertificateStoreType
Method
Purpose Set the store type for all the connection factories.
Parameter Description
type The type of certificate store. Can be either EMSSSL_STORE_TYPE_SYSTEM or
EMSSSL_STORE_TYPE_FILE. See EMSSSLStoreType on page 257 for details.
EMSSSL.SetClientTracer
Method
.Remarks Client tracing prints loaded certificates and information about the SSL handshake
errors and results.
Parameter Description
tracer The output stream to send the tracing information. Specify null as parameter
to disable client tracing.
EMSSSL.SetHostNameVerifier
Method
Parameter Description
verifier Host name verifier. Set to null to remove custom host name verifier.
See EMSSSLHostNameVerifier on page 255 for details.
EMSSSL.SetTargetHostName
Method
Remarks This is a required parameter for all .NET SSL connections. Because
System.Net.Security.SslStream requires a target host, this value is required.
Parameter Description
targetHostName The name of the server as defined in the server's certificate. Usually the
server's HostName is specified as the CN in the server's certificate.
EMSSSLFileStoreInfo
Class
Remarks The File Store Info object sets the store for a connection factory via the
ConnectionFactory.SetCertificateStoreType method or while using the
global EMSSSL API to set the certificate store. The store info consists of the client's
identity (the only type supported is the pkcs12 file aka .pfx file format), the SSL
password for the private key stored in the pkcs12 file and any optional trusted
certificates.
EMSSSLFileStoreInfo
Constructor
Declaration EMSSSLFileStoreInfo();
EMSSSLFileStoreInfo.ClearTrustedCerts
Method
EMSSSLFileStoreInfo.SetSSLClientIdentity
Method
Remarks Overloaded. The only file type that is supported here is a pkcs12 or .pfx file.
NOTE: If other file format are specified then a configuration exception will be
thrown during the SSL handshake.
To set the Client Identity as a string:
public void SetSSLClientIdentity(clientId);
Parameter Description
certificate A pkcs12 or .pfx file used to identify the client.
EMSSSLFileStoreInfo.SetSSLPassword
Method
Parameter Description
password The SSL Password.
EMSSSLFileStoreInfo.SetSSLTrustedCertificate
Method
Parameter Description
certificate The name of the certificate to add to the list of trusted certificates.
EMSSSLSystemStoreInfo
Class
Remarks The System Store Info object sets the store for a connection factory via the
ConnectionFactory.SetCertificateStoreType method or while using the
global EMSSSL API to set the certificate store. The store info consists of the store
location, store name, the certificate name (to look for in the specified store name at
the specified store location).
The default store location is StoreLocation.CurrentUser and the default store
name is 'my' store as defined by the .NET framework. The search criteria to find
the certificate in the store name at the store location is
X509FindType.FindBySubjectDistinguishedName.
EMSSSLSystemStoreInfo
Constructor
Declaration EMSSSLSystemStoreInfo();
Remarks This object is used mainly to specify system store information when the store type
of SYSTEM is used by the ConnectionFactory.SetCertificateStoreType
method.
EMSSSLSystemStoreInfo.SetCertificateName
Method
Remarks This method sets the name of the certificate. The certificate name is the subject
distinguished name of the certificate. During the SSL handshake, the server
searches for the named certificate in the store specified by
EMSSSLSystemStoreInfo.SetCertificateStoreName at the location specified
by EMSSSLSystemStoreInfo.SetCertificateStoreLocation.
While searching for the certificate in the certificate store the tag 'CN' is
automatically prepended to the certificate name.
Parameter Description
certName Certificate name.
EMSSSLSystemStoreInfo.SetCertificateStoreLocation
Method
Remarks The certificate store location indicates where to lookup the certificate by name. If
no store name is specified, then the default store name is "My" store name within
this store location.
Parameter Description
storeLocation Location in which to lookup certificate by name. For example, "CurrentUser"
or "LocalMachine."
EMSSSLSystemStoreInfo.SetCertificateStoreName
Method
Remarks This is the name of the store in which certificates are stored. During the SSL
handshake, this is where the client library looks for the certificates.
Parameter Description
storeName Name of the certificate store.
EMSSSLHostNameVerifier
Delegate
Remarks The user can perform any necessary specific validations in the host name verifier
delegate, returning false will cause the SSL handshake to terminate, returning
true will cause the SSL handshake to continue.
Parameter Description
sender The source of the event.
EMSSSLHostNameVerifierArgs
Class
Member Description
m_certificateCommonName string m_certificateCommonName;
EMSSSLStoreType
Enumeration
Member Description
EMSSSL_STORE_TYPE_FILE Public const to be used if the certificates are stored in a
pkcs12 (aka .pfx) file.
Chapter 13 Utilities
This chapter presents classes and interfaces that define constants and utility
methods.
Topics
DeliveryMode
Class
Member Description
Fields
NON_PERSISTENT int
Non-persistent delivery.
PERSISTENT int
Persistent delivery.
RELIABLE_DELIVERY int
IEMSSerialziable
Interface
.NET Compact This interface is available only in .NET Compact Framework. Programmers can
Framework use it to allow otherwise excluded objects within an ObjectMessage.
Remarks When an object class implements this interface, it can be serialized within an
ObjectMessage.
To implement this interface for a class, define the methods listed below and a
constructor that does not require any arguments.
IEMSSerialziable.Deserialize
Method
Parameter Description
stream Deserialize the data from this stream to reconstruct an object.
Remarks When this method is called, the stream already contains context information. That
context information resides before the write position of the stream when this
method is called (call it initWritePos). Your implementation of this method
must not modify that context information, nor reset the stream’s write pointer to a
position before initWritePos.
Similarly, your implementation must not close the stream.
IEMSSerialziable.Serialize
Method
Parameter Description
stream Serialize the object’s data to this stream.
Remarks When this method is called, the stream already contains context information. That
context information resides before the write position of the stream when this
method is called (call it initWritePos). Your implementation of this method
must not modify that context information, nor reset the stream’s write pointer to a
position before initWritePos.
Similarly, your implementation must not close the stream.
MessageDeliveryMode
Enumeration
Remarks The class DeliveryMode defines a parallel set of constants as ordinary integers.
However, we recommend this enumeration, because it enables .NET to do
stronger type checking at compile time, which can enhance program reliability.
Member Description
NonPersistent Non-persistent delivery.
Tibems
Class
Constant Description
Connection-Related Fields (Constants)
Programs can use these constants as names of settings in the hash table argument to
ConnectionFactory.CreateConnection. They govern the behavior of the resulting connections
that the factory creates.
DEFAULT_FACTORY_PASSWORD string
DEFAULT_FACTORY_USERNAME string
FACTORY_LOAD_BALANCE_METRIC string
Constant Description
Message-Related Fields (Constants)
Programs can use these constants as names of message properties.
JMS_TIBCO_CM_PUBLISHER string
JMS_TIBCO_CM_SEQUENCE string
JMS_TIBCO_COMPRESS string
JMS_TIBCO_DISABLE_SENDER string
JMS_TIBCO_IMPORTED string
JMS_TIBCO_MSG_EXT string
Constant Description
JMS_TIBCO_MSG_TRACE string
JMS_TIBCO_PRESERVE_UNDELIVERED string
JMS_TIBCO_SENDER string
JMS_TIBCO_SS_SENDER string
Tibems.GetConnectionActiveURL Return the URL of the EMS server for the 276
specified connection.
Tibems.CalculateMessageSize
Method
Purpose Returns the total size (in bytes) of a message in wire format.
This method might consume process storage, and might involve disk I/O—with
associated performance penalties.
Parameter Description
msg Compute the size of this message.
Tibems.CreateFromBytes
Method
Parameter Description
bytes Fill the new message with this byte array.
This byte array must be the result of previously calling
Tibems.GetAsBytes.
Remarks The newly created message is read-only; to enable modification without erasing
the content, call Tibems.MakeWriteable.
Tibems.GetAllowCloseInCallback
Method
Tibems.GetAsBytes
Method
Remarks The byte array includes the message headers, properties and body.
Parameter Description
message Fill the byte array with the content of this message.
Tibems.GetConnectAttempts
Method
Remarks This setting governs all client Connection objects as they attempt to connect to
the server. Its value is a string of the form attempts or attempts,delay:
• attempts limits the number of times that the connection object attempts to
establish a connection to the server. When this property is absent, the default
value is 2. The minimum value is 1.
• delay is the time (in milliseconds) between connection attempts. When absent,
the default value is 500. The minimum value is 250.
Tibems.GetConnectAttemptTimeout
Method
Tibems.GetConnectionActiveURL
Method
Purpose Return the URL of the EMS server for the specified connection.
Parameter Description
connection The connection to the EMS server.
Tibems.GetEncoding
Method
Remarks If the global encoding has not been set, this method returns null.
Programs can override the global encoding for individual messages. When
neither a global nor an individual message encoding has been set, then EMS
encodes the strings of an outbound message using the default UTF-8 encoding.
This encoding applies to all strings in message bodies (names and values), and
properties (names and values). It does not apply to header names nor values. The
methods BytesMessage.ReadUTF and BytesMessage.WriteUTF are exempt from
global and individual encoding settings.
Tibems.GetExceptionOnFTSwitch
Method
Remarks This setting determines exception behavior when the client successfully switches
to a different server (fault-tolerant failover).
• When true, the connection’s ExceptionListener catches an EMSException,
which contains the name of the new server.
• When false, fault-tolerant failover does not trigger an exception in the client.
Tibems.GetMessageEncoding
Method
Remarks If the encoding has not been set for the individual message, this method returns
null.
This encoding for an individual message overrides the global encoding. When
neither a global nor an individual encoding has been set, then EMS encodes the
strings of an outbound message using the default UTF-8 encoding.
This encoding applies to all strings in message bodies (names and values), and
properties (names and values). It does not apply to header names nor values. The
methods BytesMessage.ReadUTF and BytesMessage.WriteUTF are exempt from
global and individual encoding settings.
Parameter Description
message Get the encoding for this message.
Tibems.GetMessageSize
Method
Purpose Return the size of a wire format message—or its body, header or properties
portions.
Remarks These four methods return cached values for the size of a message or its parts.
The sizes are implicitly measured and cached when an inbound message arrives
at the client, and when the client sends an outbound message. If the client
modifies a message, or creates a message but never sends it, then these methods
could yield incorrect cached values. To explicitly force a new measurement and
cache its results, call Tibems.CalculateMessageSize; then these methods yield
correct values.
GetMessageSize returns the total size of a message—that is, the number of bytes
that traverse the network when the client sends the message. This total is slightly
larger than the sum of its three constituent parts, because it includes additional
control information. Furthermore, the server adds its own control information as
well, so the size of message as measured by receivers is slightly larger than its size
as measured by the sender.
Parameter Description
msg Return the cached size of this message, or one of its parts.
Tibems.GetPingInterval
Method
Purpose Return the interval at which the client tests network connectivity.
Remarks Clients test network connectivity by sending ping requests to the server at regular
intervals. This method returns that interval (in seconds). Zero is a special value
that disables ping testing.
Tibems.GetProperty
Method
Parameter Description
key Return the value associated with this property name.
You may supply any of the constants listed in the table below. The constants
are defined as static fields of Tibems. The values of those constants are the
actual property names.
Tibems.GetReconnectAttempts
Method
Remarks This setting governs all client Connection objects as they attempt to reconnect to
the server after a network disconnect. Its value is a string of the form attempts or
attempts,delay:
• attempts limits the number of times that the connection object attempts to
reestablish a connection to the server. When this property is absent, the
default value is 4. The minimum value is 1.
• delay is the time (in milliseconds) between reconnection attempts. When
absent, the default value is 500. The minimum value is 250.
Tibems.GetReconnectAttemptTimeout
Method
Tibems.GetSessionDispatcherDaemon
Method
Remarks When a program uses asynchronous message consumers (either message listeners
or .NET message event handler delegates), EMS creates internal dispatcher
threads for each Session that has at least one asynchronous message consumer.
When this setting is true, those dispatcher threads are daemon threads; when
false (the default) they are not daemon threads.
.NET Compact The .NET Compact Framework does not support daemon threads. This call
Framework always returns false.
Tibems.GetSocketReceiveBufferSize
Method
Remarks When set, this value overrides the operating system’s default for the size of
receive buffers associated with sockets that the client uses for connections to the
server. (Some operating systems do not allow you to override the default size.)
Tibems.GetSocketSendBufferSize
Method
Remarks When set, this value overrides the operating system’s default for the size of send
buffers associated with sockets that the client uses for connections to the server.
(Some operating systems do not allow you to override the default size.)
Tibems.MakeWriteable
Method
Parameter Description
message Make this message writable.
Tibems.SetAllowCloseInCallback
Method
Purpose Override a JMS requirement so client callbacks may call close methods.
Parameter Description
allow When true, EMS overrides the JMS specification.
When false (the default), EMS obeys the JMS specification.
Tibems.SetConnectAttempts
Method
Remarks This setting governs all client Connection objects as they attempt to connect to
the server.
Parameter Description
specs Set the connect setting to these specifications. The value must be string of the form
attempts or attempts,delay:
• attempts limits the number of times that the connection object attempts to
establish a connection to the server. When this property is absent, the default
value is 2. The minimum value is 1.
• delay is the time (in milliseconds) between connection attempts. When absent,
the default value is 500. The minimum value is 250.
Tibems.SetConnectAttemptTimeout
Method
Purpose Set the maximum amount of time a client will wait for the connection to be
established.
Remarks When too many clients connect to the same server, the server may not be able to
accept all connections at the same time or may run out of system resources. This
method specifies the amount of time a client is willing to wait for a connection to
be established. Internally the client library will tear down any hung connections
(either because of non-availability of system resources or some other EMS server
problem) after the timeout period has elapsed.
Parameter Description
timeout Timeout value, in milliseconds. The minimum value is 100 milliseconds, if value
less than 100 milliseconds is specified, then the minimum value of 100 milliseconds
is used.
Default value is 0 (no timeout).
Tibems.SetEncoding
Method
Remarks Programs can override the global encoding for individual messages. When
neither a global nor an individual message encoding has been set, then EMS
encodes the strings of an outbound message using the default UTF-8 encoding.
This encoding applies to all strings in message body fields (names and values),
and properties (names and values). It does not apply to message header fields.
The methods BytesMessage.ReadUTF and BytesMessage.WriteUTF are exempt
from global and individual encoding settings.
The only encoding names supported by the .NET client are the ones defined by
the .NET framework. Please refer to the .NET framework documentation for a
complete list of the supported encoding names.
Parameter Description
encodingName The name of the encoding (for example, "utf-8").
An EMSException is generated if the encoding is not supported.
For a list of standard encoding names, see www.iana.org.
Tibems.SetExceptionOnFTSwitch
Method
Remarks This setting determines exception behavior when the client successfully switches
to a different server (fault-tolerant failover).
Parameter Description
callExceptionListener When true, the connection’s ExceptionListener catches an
EMSException, which contains the name of the new server.
Tibems.SetMessageEncoding
Method
Remarks This encoding for an individual message overrides the global encoding. When
neither a global nor an individual message encoding has been set, then EMS
encodes the strings of an outbound message using the default UTF-8 encoding.
This encoding applies to all strings in message bodies (names and values), and
properties (names and values). It does not apply to header names nor values. The
methods BytesMessage.ReadUTF and BytesMessage.WriteUTF are exempt from
global and individual encoding settings.
Parameter Description
message Set the encoding for this message.
Tibems.SetPingInterval
Method
Purpose Set the interval at which the client tests network connectivity.
Remarks Clients test network connectivity by sending ping requests to the server at regular
intervals. This method sets that interval (in seconds). If your program calls this
method, it must do so before creating its first Connection object; after creating
that object, this call has no effect.
Parameter Description
seconds Ping at this interval (in seconds).
Zero is a special value that disables ping testing.
Tibems.SetProperty
Method
Remarks In .NET, methods exist to get and set the properties. SetProperty provides an
alternate way to set property values, which is consistent with the EMS Java API
(for easy porting to .NET).
Parameter Description
key Set the value associated with this property name.
You may supply any of the constants listed in the table below. The constants
are defined as static fields of Tibems. The values of those constants are the
actual property names.
Tibems.SetReconnectAttempts
Method
Remarks This setting governs all client Connection objects as they attempt to reconnect to
the server after a network disconnect.
Parameter Description
specs Set the reconnect setting to these specifications. The value must be string of the
form attempts or attempts,delay:
• attempts limits the number of times that the connection object attempts to
reestablish a connection to the server. When this property is absent, the default
value is 4. The minimum value is 1.
• delay is the time (in milliseconds) between reconnection attempts. When absent,
the default value is 500. The minimum value is 250.
Tibems.SetReconnectAttemptTimeout
Method
Purpose Sets the maximum amount of time a client will wait for the reconnect to complete.
Parameter Description
timeout Timeout value, in milliseconds. The minimum value is 100 milliseconds, if value
less than 100 milliseconds is specified, then the minimum value of 100 milliseconds
is used.
Default value is 0 (no timeout).
Tibems.SetSessionDispatcherDaemon
Method
Remarks When a program uses asynchronous message consumers (either message listeners
or .NET message event handler delegates), EMS creates internal dispatcher
threads for each Session that has at least one asynchronous message consumer.
When this setting is true, those dispatcher threads are daemon threads; when
false (the default) they are not daemon threads.
Parameter Description
makeDaemon • When true, dispatcher threads are daemon threads.
• When false, (the default) they are not daemon threads
.NET Compact The .NET Compact Framework does not support daemon threads. This call has
Framework no effect, and returns without error.
Tibems.SetSocketReceiveBufferSize
Method
Remarks This value overrides the operating system’s default for the size of receive buffers
associated with sockets that the client uses for connections to the server.
Use this call before creating server connections. This call sets an override buffer
size for new socket buffers; it does not change the size of existing socket buffers.
Parameter Description
size Sockets use receive buffers of this size (in kilobytes).
.NET Compact The .NET Compact Framework does not permit changing the default socket
Framework buffer size. This call has no effect, and returns without error.
Tibems.SetSocketSendBufferSize
Method
Remarks This value overrides the operating system’s default for the size of send buffers
associated with sockets that the client uses for connections to the server.
Use this call before creating server connections. This call sets an override buffer
size for new socket buffers; it does not change the size of existing socket buffers.
Parameter Description
size Sockets use send buffers of this size (in kilobytes).
.NET Compact The .NET Compact Framework does not permit changing the default socket
Framework buffer size. This call has no effect, and returns without error.
Chapter 14 Exception
Topics
EMSException
Class
Remarks EMS methods throw instances of this class and its subclasses.
Member Description
Properties
When an exception results from a server error, this property holds the
server’s error code.
Subclasses EMSException
IllegalStateException
InvalidClientIDException
InvalidDestinationException
InvalidSelectorException
MessageEOFException
MessageFormatException
MessageNotReadableException
MessageNotWriteableException
NamingException
AuthenticationException
CannotProceedException
CommunicationException
ConfigurationException
InvalidNameException
NameNotFoundException
ServiceUnavailableException
ResourceAllocationException
SecurityException
TransactionInProgressException
TransactionRolledBackException
EMSException (
string reason,
string errorCode );
AuthenticationException
Class
CannotProceedException
Class
Remarks A destination lookup request found both a queue and a topic with the specified
name. To resolve this situation, specify the destination name in one of these forms:
• $topic:<topic-name>
• $queue:<queue-name>
CommunicationException
Class
Remarks This exception could indicate a version mismatch between the client and
tibemsd.
ConfigurationException
Class
Remarks When the client initialized the lookup context, some parameter values were
missing or invalid.
IllegalStateException
Class
Origin JMS.
Remarks For example, Session.Commit throws this exception when the session is
non-transactional.
InvalidClientIDException
Class
Origin JMS.
InvalidDestinationException
Class
Origin JMS.
InvalidNameException
Class
Remarks The most common syntax error is a prefix other than tibjmsnaming:// (or a
misspelling).
InvalidSelectorException
Class
Origin JMS.
MessageEOFException
Class
Origin JMS.
MessageFormatException
Class
Origin JMS.
MessageNotReadableException
Class
Origin JMS.
MessageNotWriteableException
Class
Origin JMS.
NameNotFoundException
Class
Purpose The name lookup repository cannot find a name; the name is not bound.
NamingException
Class
Member Description
Properties
Remarks Members of LookupContext throw instances of this class and its subclasses.
Subclasses NamingException
AuthenticationException
CannotProceedException
CommunicationException
ConfigurationException
InvalidNameException
NameNotFoundException
ServiceUnavailableException
ResourceAllocationException
Class
Origin JMS.
SecurityException
Class
Origin JMS.
Remarks For example, the provider rejects a user or the user’s authentication.
ServiceUnavailableException
Class
Purpose A lookup request failed because the client could not connect to the server.
TransactionInProgressException
Class
Origin JMS.
Remarks When a session uses an XA transaction manager, the XA resource is the correct
locus for all commit and rollback requests. Local commit or rollback calls are not
permitted, and throw this exception.
TransactionRolledBackException
Class
Origin JMS.
Index
A compression 3
ConfigurationException 311
Acknowledge 25 Connection 118
AuthenticationException 308 Close 121
CreateSession 122
Start 123
Stop 124
B ConnectionConsumer (not supported) 3
ConnectionFactory 138
body types, message 9 constructor 141
BodyLength 32 CreateConnection 142
BytesMessage 32 ConnectionMetaData 125
Read methods 34 conversion, data type 21
ReadBytes 36 CreateBrowser 178
Reset 40 CreateBytesMessage 179
Write methods 37 CreateConnection 142
WriteBytes 39 CreateConsumer 180
CreateDurableSubscriber 181
CreateFromBytes 271
CreateMapMessage 183
C CreateObjectMessage 184
CreateProducer 185
CalculateMessageSize 270 CreateQueue 186
CannotProceedException 309 CreateQueueConnection 162
character encoding 4, 277, 279, 293, 295 CreateQueueSession 127
ClearBody 26 CreateSession 122
ClearProperties 26 CreateStreamMessage 187
Clone 26 CreateTemporaryQueue 188
Close CreateTemporaryTopic 189
Connection 121 CreateTextMessage 190
MessageConsumer 82 CreateTopic 191
MessageProducer 97 CreateTopicConnection 165
QueueBrowser 204 CreateTopicSession 129
QueueRequestor 110 customer support xvii
Session 176
TopicRequestor 114
Commit 177
CommunicationException 310
Compact Framework 5
D G
daemon threads 3 Get
data type conversion 21 MapMessage 44
Delete message properties 28
TemporaryQueue 73 GetAllowCloseInCallback 272
TemporaryTopic 75 GetAsBytes 273
DeliveryMode 260 GetConnectAttempts 274
Deserialize 262 GetConnectAttemptTimeout 275
Destination 69 GetDeliveryModeName 27
overview 66 GetEncoding 277
durable subscription GetEnumerator 205
unsubscribe 195 GetExceptionOnFTSwitch 278
dynamic destination 66 GetMessageBodySize 280
GetMessageEncoding 279
GetMessageHeadersSize 280
GetMessageSize 280
E GetPingInterval 281
GetProperty, Tibems 282
EMSException 306 GetReconnectAttempts 284
EMSExceptionEventArgs 131 GetReconnectAttemptTimeout 285
constructor 132 GetSessionDispatcherDaemon 286
EMSExceptionHandler 130 GetSocketReceiveBufferSize 287
EMSMessageEventArgs 88 GetSocketSendBufferSize 288
constructor 89
Message 88
EMSMessageHandler 87
encoding, character 4, 277, 279, 293, 295 H
exceptions 305
headers, message 10
F
I
FactoryLoadBalanceMetric 167
fault tolerance IEMSSerialziable 261
ActiveURL 119 Deserialize 262
failover exceptions 278, 294 Serialize 263
FieldCount IExceptionListener 133
MapMessage 41 OnException 134
StreamMessage 50 IllegalStateException 312
IMessageListener 90
OnMessage 91
InvalidClientIDException 313
InvalidDestinationException 314
P ReadBytes
BytesMessage 36
property, message 15 StreamMessage 54
get 28 read-only 26, 40, 55, 271, 320
set 30 Receive 83
PropertyExists 29 ReceiveNoWait 84
Publish 104 Recover 192
RemoveSettings 220
Request
QueueRequestor 111
Q TopicRequestor 115
request 10
Queue 70 Reset
constructor 71 BytesMessage 40
QueueName 70 QueueBrowser 207
QueueReceiver 85 StreamMessage 55
QueueBrowser 202 ResourceAllocationException 323
Close 204 Rollback 193
GetEnumerator 205 Run (obsolete) 194
MoveNext 206
Reset 207
QueueConnection 126
CreateQueueSession 127 S
QueueConnectionFactory 161
CreateQueueConnection 162 SecurityException 324
QueueName 70 selectors, message 18
QueueReceiver 85 Send
Queue 85 MessageProducer 98
QueueRequestor 108 QueueSender 101
Close 110 serializable object interface 261
constructor 109 serialization 3
Request 111 Serialize 263
QueueSender 100 ServerSession (not supported) 3
Send 101 ServerSessionPool (not supported) 3
QueueSender.Send 101 ServiceUnavailableException 325
QueueSession 196
R
Read
BytesMessage 34
StreamMethod 53