JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
ToolTalk User's Guide
search filter icon
search icon

Document Information

Preface

1.  Introducing the ToolTalk Service

2.  An Overview of the ToolTalk Service

3.  Message Patterns

4.  Setting Up and Maintaining the ToolTalk Processes

5.  Maintaining Application Information

6.  Maintaining Files and Objects Referenced in ToolTalk Messages

7.  Participating in ToolTalk Sessions

8.  Sending Messages

9.  Dynamic Message Patterns

10.  Static Message Patterns

11.  Receiving Messages

Retrieving Messages

Identifying and Processing Messages Easily

Recognizing and Handling Replies Easily

Checking Message Status

Examining Messages

Callback Routines

Callbacks for Messages Addressed to Handlers

Attaching Callbacks to Static Patterns

Handling Requests

Replying to Requests

Rejecting or Failing a Request

Rejecting a Request

Failing a Request

Observing Offers

Destroying Messages

12.  Objects

13.  Managing Information Storage

14.  Handling Errors

A.  Migrating from the Classing Engine to the ToolTalk Types Database

B.  A Simple Demonstration of How the ToolTalk Service Works

C.  The ToolTalk Standard Message Sets

D.  Frequently Asked Questions

Glossary

Index

Callback Routines

You can tell the ToolTalk service to invoke a callback when a message arrives because a pattern has been matched.

p = tt_pattern_create();
   tt_pattern_op_add(p, "EDIT");
   ... other pattern attributes
   tt_pattern_callback_add(p, do_edit_message);
   tt_pattern_register(p);

Note - Callbacks are called in reverse order of registration (for example, the most recently added callback is called first).


illustrates how the ToolTalk service invokes message and pattern callbacks when tt_message_receive is called to retrieve a new message.

Figure 11-1 How Callbacks Are Invoked

Callbacks for Messages Addressed to Handlers

After the ToolTalk service determines the receiver for a message addressed to a handler, it matches the message against any patterns registered by the receiver. (Messages explicitly addressed to handlers are point-to-point messages and do not use pattern matching.)

Attaching Callbacks to Static Patterns

Numeric tags (opnums) can be attached to each signature in a ptype when a static pattern is created. A callback can now be attached to the opnum. When a message is delivered because it matched a static pattern with an opnum, the ToolTalk service checks for any callbacks attached to the opnum and, if any exists, runs them.