What are Message Types?


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.

Table 1 Standard Message Types
Message Type (Tipc.Mt)
Grammar
Description
ALERT
id /*object*/
str /*message*/
alert message
BOOLEAN_DATA
{ id /*name*/
bool /*value*/ }
boolean data values
CANCEL_ALERT
id /*object*/
str /*message*/
cancel an alert
CANCEL_WARNING
id /*object*/
str /*message*/
cancel a warning
CONN_INIT
str /*unique_subject*/
id /*node*/
id /*user*/
int4 /*pid*/
id /*arch*/
one-time connection initialization information exchanged when RTclient and RTserver rendezvous
CONNECT_CALL
id /*project*/
str /*ident*/
int2 /*disconnect_mode*/
str_array /*init_subscribes*/
int4_array /*lb_status*/
information RTclient supplies when connecting to RTserver
CONNECT_RESULT
bool /*status_flag*/
str /*status_output*/
str /*def_subj_prefix*/
information RTserver supplies back to RTclient
DISCONNECT
int2 /*disconnect_mode*/
RTclient explicitly disconnecting from RTserver
ENUM_DATA
{ id /*name*/
id /*value*/ }
enumerated data values
INFO
str /*message */
information message
NUMERIC_DATA
{ id /*name*/
real8 /*value*/ }
numeric data values
SERVER_STOP_CALL
int /*stop_type*/
request RTserver to shut itself down
SERVER_STOP_RESULT
str /*result_output*/
information RTserver supplies as it is shutting down
STRING_DATA
{ id /*name*/
str /*value*/ }
string data values
SUBJECT_SET_SUBSCRIBE
id /*subject*/
bool /*subscribe_flag*/
bool /*lb_flag*/
start or stop subscribing to a subject
WARNING
id /*object*/
str /*message*/
warning message

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:

mt = TipcSvc.lookupMt("numeric_data"); 
mt = TipcSvc.lookupMt(TipcMt.NUMERIC_DATA); 

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