Method CreateTopic
CreateTopic(String, TopicPriority)
Creates and retrieves the topic instance against the specified topic name.
Declaration
ITopic CreateTopic(string topicName, TopicPriority topicPriority = TopicPriority.Normal)
Parameters
Type | Name | Description |
---|---|---|
System.String | topicName | Name or a pattern to identify topic. |
TopicPriority | topicPriority | Topic Priority is an optional parameter which has a default value of TopicPriority.Normal. |
Returns
Type | Description |
---|---|
ITopic | Returns the topic instance, null if it does not exist. |
Examples
The following example demonstrates how to create a topic. First, initialize the cache.
ICache cache = CacheManager.GetCache("demoCache");
Then, get messaging service from the cache.
IMessagingService messagingService = cache.MessagingService;
Then, create the topic from messagingService.
ITopic topic = messagingService.CreateTopic("mytopic");