TipcConnQueueCbCreate


Name

TipcConnQueueCbCreate — create a queue callback in a connection

Synopsis

T_CB TipcConnQueueCbCreate(conn, mt, func, arg) 
T_IPC_CONN conn; 
T_IPC_MT mt; 
T_IPC_CONN_QUEUE_CB_FUNC func; 
T_CB_ARG arg; 

Arguments

conn — connection to create callback for

mt — message type to create callback for (null means global callback)

func — callback function

arg — user-defined argument to pass to func

Return Values

New callback if successful, NULL otherwise.

Diagnostics

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

Description

TipcConnQueueCbCreate creates a queue callback in a connection. These callbacks are called when a message is inserted into or deleted from a connection’s queue of incoming messages. Connection queue callbacks are useful for watching the messages that have been read in by a connection, but not yet processed. There is some overlap between read callbacks and queue callbacks. See TIBCO SmartSockets Utilities for more information on callbacks.

A queue callback is usually created for a specific message type and connection. If the message type is null, then a global queue callback is created for all message types on that connection.

Caution

The T_ENTRY declaration specifier is required in the definition of all callback functions as well as their prototypes.

See Also

TipcConnQueueCbLookup; see the TIBCO SmartSockets Utilities for information on TutCbDestroy.

Examples

This example creates a global connection queue callback that prints out how the queue is changing:

void T_ENTRY my_conn_queue_cb(conn, data, arg) 
T_IPC_CONN conn; 
T_IPC_CONN_QUEUE_CB_DATA data; 
T_CB_ARG arg; /* not used */ 
{ 
  if (data->insert_flag)  
      TutOut("A message has been inserted at position %d\n",  
           data->position);  
  else  
      TutOut("A message has been deleted at position %d\n",  
           data->position); 
} /* my_conn_queue_cb */ 
 
/* =========================================================== */ 
/*...code from calling function is below */ 
 
/* global connection queue callback */ 
if (TipcConnQueueCbCreate(conn, NULL, my_conn_queue_cb, NULL) 
                          == NULL) { 
  return;  /* error */ 
}  
 
 
 

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