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 pattern to identify topic. |
TopicPriority | topicPriority | Topic prioririty is an optional paramater which has 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 cache.
ICache cache = CacheManager.GetCache("demoCache");
Then get messaging service from cache.
IMessagingService messagingService=cache.MessagingService;
Then create topic from messagingService
ITopic topic=messagingService.CreateTopic("mytopic");