ToolTalk User's Guide

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.