Creating Topics

When using the Solace JavaScript API and Solace Node.js API (which are object-oriented), a client must create a topic instance to encapsulate a topic name that can be used as a destination to publish messages to. Topic instances can also be used by consumers to indicate through subscriptions what messages they are interested in receiving.

When using the Solace JavaScript API and Solace Node.js API, a generic Destination instance is created and used instead of a topic instance.

Clients can create:

  • Non-temporary topics at the factory level.
  • Temporary topics at the session level. The scope and lifetime of a temporary topic is that of the session it is created in.

For information on the supported topic syntax rules, refer to Topic Support & Syntax.

Topics

To create a topic (non-temporary), call solace.SolClientFactory.createTopicDestination(...) on a connected session and pass in a topic name.