ToolTalk User's Guide

What is the basic flow of a message?

There are two types of message flow:

Session-Scoped Message Flow

The basic flow of a session-scoped message is as follows:

  1. The client builds request message and calls tt_message_send.

  2. ttsession finds a handler.

    The environment variable TT_TOKEN is set by ttsession when it starts the handler.

  3. The handler starts up and calls tt_open and tt_fd to establish communication to ttsession.

  4. The handler declares its ptype to ttsession.

  5. ttsession changes all the static patterns for the ptype into dynamic patterns.

    At this point, the patterns are not active because the handler has not yet joined the session.

  6. The handler joins session, activating patterns.

  7. ttsession notifies the handler that a message is queued.

  8. The handler notices activity on the file descriptor and calls tt_message_receive to retrieve the message.

    If the message returned by tt_message_receive has the status TT_WRN_START_MESSAGE, the ToolTalk service started the process to deliver the message. In this case, messages for the ptype are blocked until the process either replies, rejects, or fails the message (even if it is a notice), or calls tt_message_accept.

  9. The handler performs the requested operation.

  10. The handler returns a reply to request.

  11. ttsession notifies the client that a (reply) message for it is in the queue.

    The client's file descriptor is activated.


    Note –

    The client actually receives a message every time its request message changes state.


  12. The client calls tt_message_receive to retrieve the result.

File-Scoped Message Flow

The basic flow of a file-scoped message is as follows:

  1. A file-scoped pattern is registered.

    libtt notifies the database server about the file and the session in which it is registering the pattern.

  2. libtt checks with the database server to find all the sessions that have clients who have registered interest in the specified file.

    • For notices, it communicates with all these sessions directly.

    • For requests, it notifies its session about the message and the list of other sessions involved.

  3. The sessions communicate amongst each other to find a handler.