Skip to main content

Publish and Subscribe Overview

Publish and Subscribe Overview

Publish and subscribe messaging works based on the runtime interactions between:

Messages

A message 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.

Topics

A topic 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, B, C, and D are subtopic 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:

books
books.fiction
books.fiction.latin

You can specify a range of topics by using * (the asterisk) as a wildcard character. For example:

  • * can replace any complete subtopic in the topic string (books.*.latin works)

  • * does not work as a partial wildcard (*s.fiction does not work; it does not match books.fiction, reviews.fiction, or any similar string)

  • A trailing * character matches any number of additional subtopics to the right of the last . (period) character in the topic string (books.* matches books.fiction and books.fiction.latin)

Subscribers

A subscriber 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.

Subscriptions

A subscription associates a subscriber with a topic string.

Suppose you have three subscribers:

Abel
Baker
Charlie

And three topics with the convention that A.B.C represents person.location.identifer:

Doctor.ICU.88495
Patient.LAB.*
*.*.X3562564

In that case, you could define the following subscriptions:

Subscriber Topic
Abel Doctor.ICU.88494
Abel Doctor.ICU.88495
Baker Doctor.ICU.88495
Baker Patient.LAB.*
Charlie *.*.X3562564

This means:

  • Abel is notified whenever the exact topics Doctor.ICU.88494 or Doctor.ICU.88495 are processed.

  • 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 is processed.

FeedbackOpens in a new tab