As described earlier, each message has a type property that defines the structure of the data property of a message. A message type can be thought of as a template for a specific kind of message, and each message can be considered an instance of a message type. For example, NUMERIC_DATA is a message type with a predefined layout requiring a series of name-value pairs, with each string name followed immediately by a numeric value. To send numeric data to a process, the sending process constructs a message that uses the NUMERIC_DATA message type. A message type is created once and is then available for use as the type for any number of messages.
SmartSockets provides dozens of standard message types that cover a wide variety of different types of information that can be passed. SmartSockets standard message types allow you to begin building your application quickly, without having to figure out how to define your own message types. When there is no standard message type to satisfy your specific need, you can easily create a user-defined message type. Both standard and user-defined message types are handled in the same manner and can co-exist within the same program and application. Once the message type is created, messages can be constructed, sent, received, and processed through a variety of methods.
Table 1 lists some of the frequently-used standard message types. Each grammar element shows the field type followed by a comment that gives a brief description of the field. The monitoring message types (named MON_*) are considered standard message types, but are discussed in detail in the TIBCO SmartSockets User’s Guide.
Any message type can be looked up, either by name or numeric ID, with the overloaded method TipcSvc.lookupMt. For example, these two lines are equally effective:
TIBCO SmartSockets™ Java Library User’s Guide and Tutorial Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |