TipcEventCreateMsg


Name

TipcEventCreateMsg — create a message event that is invoked based on a message’s subject

Synopsis

T_IPC_EVENT TipcEventCreatMsg(dispatcher, srv, subject, event_func, event_arg) 
T_IPC_DISPATCHER dispatcher; 
T_IPC_SRV srv; 
T_STR subject; 
T_IPC_EVENT_FUNC event_func; 
T_PTR event_arg; 

Arguments

dispatcher — the dispatcher on which to invoke the event

srv — an RTserver connection to wait for messages on

subject — the subject that triggers the event

event_func — the function to be invoked

event_arg — an optional argument to pass to the event_func

Return Values

A new event if successful, NULL otherwise.

Diagnostics

If TipcEventCreateMsg fails, it returns FALSE and sets the global SmartSockets error number to one of:

Description

TipcEventCreateMsg creates a message event of type T_IPC_EVENT_MSG to be invoked when a message arrives on the srv connection whose destination matches subject.

Caution

The message must not be destroyed from within the event’s callback function. SmartSockets manages the message and automatically destroys the message once all events are dispatched. If you need to keep a copy of the message, call TipcMsgClone.

See Also

TipcEventGetType, TipcEventCreateMsgType

Examples

This example creates a message event that is triggered by a message’s subject:

void T_ENTRY msgFunc(T_IPC_EVENT event, T_IPC_EVENT_DATA data, 
                     T_PTR arg) 
{ 
  TipcMsgPrint(data->msg, TutOut); 
} 
 
/* =========================================================== */ 
/*...code from main program is below */ 
 
msg_event = TipcEventCreateMsg(dispatcher, srv, "/stocks", 
msgFunc, 
                               T_NULL); 
if (msg_event == NULL) { 
  return;  /* error */ 
} 

TIBCO SmartSockets™ Application Programming Interface
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com