Creating Topics

When using the Solace .NET API, 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.

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 one of the methods listed below on a connected session and pass in a topic name.

To create topics in the Solace .NET API, use:

  • ContextFactory.createTopic(...)

  • Helper.Destination.TopicFromEncodedName(...)

Temporary Topics

To create a temporary topic, call one of the listed methods on a connected session. A temporary topic's physical name is automatically generated by the API.

A temporary topic can only be created on a connected session.

To create temporary topics in the Solace .NET API, use:

ISession.createTemporaryTopic()

Related Samples

For an example of how to create topics and temporary topics, refer to the SimpleFlowToTopic sample for the Solace .NET API.