Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
  Previous   Contents   Next 
   
 
Chapter 3

Message Patterns

This chapter describes how to provide message pattern information to the ToolTalk service. The ToolTalk service uses message patterns to determine message recipients. After receiving a message, the ToolTalk service compares the message to all current message patterns to find a matching pattern. Once a match is made, the message is delivered to the application that registered the message pattern.

You can provide message pattern information to the ToolTalk service using either dynamic or static methods, or both. The method you choose depends on the type of messages you want to receive.

  • If the types of messages you want to receive will vary while your application is running, the dynamic method allows you to add, change, or remove message pattern information after your application has started.

  • If you want a message to start your application or to be queued if your application is not running, the static method provides an easy way to specify these instructions. The static method also provides an easy way to specify the message pattern information if you want to receive a defined set of messages. For more information, see Chapter 10, Static Message Patterns.

Regardless of the method you choose to provide message patterns to the ToolTalk service, you will want to update these patterns with each current session and file information so that you receive all messages that reference the session or file in which you are interested.

Message Pattern Attributes

The attributes in your message pattern specify the type of messages you want to receive. Although some attributes are set and have only one value, you can supply multiple values for most of the attributes you add to a pattern.

Table 3-1 provides a complete list of attributes you can put in your message patterns.

Table 3-1 ToolTalk Message Pattern Attributes

Pattern Attribute

Value

Description

Category

TT_OBSERVE TT_HANDLE TT_HANDLE_PUSH TT_HANDLE_ROTATE

Declares whether you want to perform the operation listed in a message or only observe a message.

Scope

TT_SESSION TT_FILE TT_FILE_IN_SESSION TT_BOTH

Declares interest in messages about a session or a file, or both; Join a session or file after the message pattern is registered to update the sessid and filename.

Arguments

arguments or results

Declares the positional arguments for the operation in which you are interested.

Context

<name, value>

Declares the keyword or non-positional arguments for the operation in which you are interested

Class

TT_NOTICE TT_REQUEST TT_OFFER

Declares whether you want to receive notices, requests, offers, or all.

File

char *pathname

Declares the files in which you are interested. If the scope of the pattern does not require a file, the file is an attribute only.

Object

char *objid

Declares what objects in which you are interested.

Operation

char *opname

Declares the operations in which you are interested.

Otype

char *otype

Declares the type of objects in which you are interested.

address

TT_PROCEDURE TT_OBJECT TT_HANDLER TT_OTYPE

Declares the type of address in which you are interested.

disposition

TT_DISCARD TT_QUEUE TT_START TT_START+TT_QUEUE

Instructs the ToolTalk service how to handle messages to your application if an instance is not currently running.

sender

char *procid

Declares the sender in which you are interested.

sender_ptype

char *ptype

Declares the type of sending process in which you are interested.

session

char *sessid

Declares the session in which you are interested.

state

TT_CREATED TT_SENT TT_HANDLED TT_FAILED TT_QUEUED TT_STARTED TT_REJECTED TT_RETURNED TT_ACCEPTED TT_ABSTAINED

Declares the state of the message in which you are interested.

All your message patterns must at least specify:

  • Category -- Whether the application wants to perform operations listed in messages or only view messages.

    • Use TT_OBSERVE if you only want to observe messages.

    • Use TT_HANDLE if you want to perform operations requested by the messages.

    • Use TT_HANDLE_PUSH if you want to use the most recently registered pattern of this category (if any) before using any pattern of another HANDLE category

    • Use TT_HANDLE_ROTATE if you want to use TT_HANDLE. If no eligible TT_HANDLE_PUSH patterns are found, use the TT_HANDLE_ROTATE pattern that was least recently used to deliver a message before using any TT_HANDLE patterns.

  • Scope -- Whether the application is interested in messages about a particular session or file.

    • Use TT_SESSION to receive messages from other processes in your session.

    • Use TT_FILE to receive messages about the file you have joined.

    • Use TT_FILE_IN_SESSION to receive messages for the file you have joined while in this session.

    • Use TT_BOTH to receive both messages for the file, the session, or the file and the session you have joined.

The ToolTalk service compares message attributes to pattern attributes as follows:

  • The ToolTalk service counts the message attribute as matched if:

    • No pattern attribute is specified.

    • The pattern does not name a context slot.

    • The pattern has an empty context slot.


      Note - The fewer pattern attributes you specify, the more messages you become eligible to receive.


  • If there are multiple values specified for a pattern attribute, one of the values must match the message attribute value. If no value matches, the ToolTalk service will not consider your application as a receiver.

  • If context slots are contained in the message, the ToolTalk service will not consider your application as a receiver unless:

    • A value specified in a context slot of a pattern matches the value specified in the message context slot.

    • When multiple context slots are specified in a message, each context slot value in the message matches a corresponding context slot value in the pattern.

 
 
 
  Previous   Contents   Next