Defining Publish and Subscribe Message Routing
InterSystems IRIS™ supports publish and subscribe message delivery. Publish and subscribe
refers to the technique of routing a message to one or more subscribers based on the fact that those subscribers have previously registered to be notified about messages on a specific topic. This chapter discusses the following topics:
Publish and subscribe messaging works based on the runtime interactions between:
is a production message. An external system receives a request and directs it into InterSystems IRIS, which converts it to a production message and sends it to a special-purpose business operation for processing.
is a string that characterizes the contents of a message. InterSystems IRIS does not define any topics; users and their applications define the meanings of topics and subtopics.
A topic string has the form A.B.C.D
, where A
, and D
strings delimited by the .
(period) character. A topic can contain any number of subtopics; each of these subtopics can be up to 50 characters long. The following are all valid topic strings:
You can specify a range of topics by using *
(the asterisk) as a wildcard character. For example:
is an entity (a user or an external system) that might be interested in a specific topic or set of topics. A subscriber entry specifies how that entity wishes to be contacted; that is, how InterSystems IRIS should send a message to it.
associates a subscriber with a topic
Suppose you have three subscribers:
In that case, you could define the following subscriptions:
Baker is notified whenever the exact topic Doctor.ICU.88495
is processed. In addition, Baker is notified whenever any message related to patients in the lab are processed.
Charlie is notified whenever anything related to a doctor or patient with an identifier of X3562564
When you configure publish and subscribe features for a production, the basic steps are:
Create a list of subscribers.
Create subscriptions to associate subscribers with topics.
Publish and subscribe messaging uses the following classes in the EnsLib.PubSub
At runtime, an incoming message is sent to a business process, which examines it for identifying details. Based on this analysis, the business process assigns the message a specific topic string that does not contain any wildcard characters. It then creates an EnsLib.PubSub.Request
message that contains this topic string and sends it to the PubSubOperation