Show TOC

Registering for Messages Sent to Another ServiceLocate this document in the navigation structure

Procedure

A service can register to receive copies of messages that are sent to a specific topic service, as follows:

            registerToMessages("MyTopicService");
         

The service receives all messages sent to it, plus all messages sent to the MyTopicService .

Filtering the Messages

Instead of receiving all messages sent to a topic service, a service can specify that it wants to receive only a subset of messages. To do this, create a SQL WHERE clause (without WHERE ) that specifies which messages to send to the service, and pass this string as a second parameter in registerToMessages() .

The SQL clause can only check predefined parameters in the message sent to the other service. For more information about predefined parameters, see Setting/Getting Parameters .

For example, the following passes all messages whose destination parameter is either A or B :

               String selector = "destination IN ('A','B')";
               registerToMessages("MyTopicService",selector);
            
Note

You cannot predict which service will receive the message first.