Callbacks


SmartSockets makes use of callbacks to allow you visibility into the internal processing. A callback is a mechanism that allows you to monitor a type of event. The callback is associated with a certain object or with all objects of a certain type. Callbacks associated with all objects of a given type are called global callbacks. When the event occurs, the specified callback function is called to notify you that the event happened.

An example of this type of function is a variable change callback. Such a callback could be used so that the application can monitor the changing of a variable’s value, and do other processing required to support the requirements. Callbacks belong to a callback list, which is an ordered set of all the callbacks created for a given event type and object.

There is a generic, abstract type of callbacks called T_CB. This type has a set of properties such as function, priority, argument, and so on. Because it is an abstract type, it is not directly accessible. You can create these abstracts with functions such as TipcSrvSubjectCbCreate. You can manipulate them with the TutCb* access functions such as TutCbSetPriority. The Tipc* functions are documented in the TIBCO SmartSockets Application Programming Interface reference, and the Tut* functions are documented in the TIBCO SmartSockets Utilities reference.

The specific types of callbacks that are provided vary depending on the process, but all SmartSockets callbacks have certain common characteristics. Each process (RTserver, RTmon, and so on.) provides a set of functions to deal with callbacks specific to that process. Typically, there is a TprocessTypeCbCreate function and a TprocessTypeCbLookup function that can be used to create and look up callbacks. Examples of these include TipcConnDefaultCbCreate, TipcConnDefaultCbLookup, TipcSrvSubjectCbCreate, and TipcSrvSubjectCbLookup. All other operations performed on callbacks are done using TutCb* functions.

These are the general common concepts that all SmartSockets callbacks share:

Any changes to a callback list, such as deletions, additions, or priority changes, are applied to the list after the current callback list has been processed. Changes to the list occur on the next traversal of the list. Here are two examples:


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