Show TOC

Procedure documentationRegistering for Messages Sent to Another Service Locate 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:

Syntax Syntax

  1. registerToMessages("MyTopicService");
End of the code.

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:

Syntax Syntax

  1. String selector = "destination IN ('A','B')";
  2. registerToMessages("MyTopicService",selector);
End of the code.

Note Note

You cannot predict which service will receive the message first.

End of the note.