Interface IMessagingService
This interface contains properties and methods required for a Messaging Service. It is implemented by MessagingService.
Namespace:
Assembly: Alachisoft.NCache.Web.dll
Syntax
public interface IMessagingService
Methods
CreateTopic(String)
Creates a topic with the specified name.
Declaration
ITopic CreateTopic(string topicName)
Parameters
Type | Name | Description |
---|---|---|
System.String | topicName |
Returns
Type | Description |
---|---|
ITopic | Returns the created topic instance |
Examples
The following example demonstrates how to create a topic.
First initialize cache.
Cache cache = NCache.InitializeCache("myCache");
Then get messaging service from cache.
IMessagingService messagingService=cache.MessagingService;
Then create topic on messagingService
ITopic topic=messagingService.CreateTopic("mytopic");
DeleteTopic(String)
Deletes the specified topic.
Declaration
void DeleteTopic(string topicName)
Parameters
Type | Name | Description |
---|---|---|
System.String | topicName |
Examples
The following example demonstrates how to get a topic.
First initialize cache.
Cache cache = NCache.InitializeCache("myCache");
Then get messaging service from cache.
IMessagingService messagingService=cache.MessagingService;
Then delete topic from messagingService
messagingService.DeleteTopic("mytopic");
GetTopic(String)
Retrieves the specified topic instance.
Declaration
ITopic GetTopic(string topicName)
Parameters
Type | Name | Description |
---|---|---|
System.String | topicName |
Returns
Type | Description |
---|---|
ITopic | Returns the topic instance, null if it does not exist. |
Examples
The following example demonstrates how to get a topic.
First initialize cache.
Cache cache = NCache.InitializeCache("myCache");
Then get messaging service from cache.
IMessagingService messagingService=cache.MessagingService;
Then get topic from messagingService
ITopic topic=messagingService.GetTopic("mytopic");