Infosys在阅读器中打开 / AI 翻译

TF6xxx - Connectivity · 0 次阅读

Topics

The message broker manages the addressing of messages via so-called "Topics". A topic can be thought of as a hierarchically organized mailbox, where the individual hierarchical levels are separated from each other by a "/". Sample:

Campus/Building1/Floor2/Room3/Temperature

When a publisher sends a message, it always specifies for which topic it is intended. A subscriber indicates which topic it is interested in. The message broker forwards the message accordingly.

Topics 1:

Wildcards

It is possible to use wildcards in conjunction with topics. A wildcard is used to represent part of the topic. In this case a subscriber may receive messages from several topics. A distinction is made between two types of wildcards:

  • Single-level wildcards
  • Multi-level wildcards

Example for single-level wildcard:

The + symbol describes a single-level wildcard. If it is used by the subscriber as described below, for example, corresponding messages to the topics are either received by the subscriber or not.

  • The receiver subscribes to Campus/Building1/Floor2/+/Temperature
  • The publisher sends to Campus/Building1/Floor2/Room1/Temperature - OK
  • The publisher sends to Campus/Building1/Floor2/Room2/Temperature - OK
  • The publisher sends to Campus/Building42/Floor1/Room1/Temperature - NOK
  • The publisher sends to Campus/Building1/Floor2/Room1/Fridge/Temperature - NOK

Example for multi-level wildcard:

The # symbol describes a multi-level wildcard. If it is used by the subscriber as described below, for example, corresponding messages to the topics are either received by the subscriber or not. The # symbol must always be the last symbol in a topic string.

  • The receiver subscribes to Campus/Building1/Floor2/#
  • The publisher sends to Campus/Building1/Floor2/Room1/Temperature - OK
  • The publisher sends to Campus/Building1/Floor2/Room2/Temperature - OK
  • The publisher sends to Campus/Building42/Floor1/Room1/Temperature - NOK
  • The publisher sends to Campus/Building1/Floor2/Room1/Fridge/Temperature - OK
  • The publisher sends to Campus/Building1/Floor2/Room1/Humidity - OK