Creating Topics
When using the Solace Java RTO 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 Solclient.Allocator.NewTopic(...) on a connected session and pass in a topic name.
Temporary Topics
To create a temporary topic, call SessionHandle.createTemporaryTopic() 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.
Related Samples
For an example of how to create topics and temporary topics, refer to the SimpleFlowToTopic sample for the Solace Java RTO API.