Diffusion .NET Classic API - Core and Common  5.9.4
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
PushTechnology.DiffusionCore.Messaging.Topic.TopicListeners Class Reference

Topic listeners cache. More...

Inheritance diagram for PushTechnology.DiffusionCore.Messaging.Topic.TopicListeners:
PushTechnology.DiffusionCore.Messaging.Topic.ITopicDeletionListener

Public Member Functions

void TopicDeleted (string topicName)
 Notifies the deletion of a topic. More...
 
override string ToString ()
 Returns a human-readable string form of this object. More...
 
void AddPriorityTopicListener (string topicName, ITopicListener listener)
 Add a listener to the map of priority listeners. More...
 
void AddTopicListener (ITopicListener listener, TopicSet topicSet, bool hasPriority=false)
 Add a topic listener for a TopicSet. More...
 
void AddTopicListener (ITopicListener listener, bool hasPriority=false, params string[] topicPatterns)
 Add a topic listener for one or more patterns. More...
 
bool RemoveTopicListener (ITopicListener topicListener)
 Removes a topic listener. More...
 
bool NotifyListeners (IMessageSource messageSource, ITopicMessage message)
 Notify all listeners that apply to the logic of the supplied message. More...
 
void ClearCache ()
 Clear the cache. More...
 

Properties

bool HasTopicListeners [get, set]
 Flag to see if we are actually using topic listeners and thus saving time if we are not. More...
 

Detailed Description

Topic listeners cache.

This maintains topic listeners for anything that might need them.

It also provides a notification method which may be used to route a message (copying each time) to all listeners that want it.

There is an ITopicDeletionListener so that it may be notified of removals from a TopicTree so that it can keep its cache tidy.

Where there is no topic tree to do this, then the TopicDeleted method can be called directly when a topic cache entry is to be removed.

Member Function Documentation

void PushTechnology.DiffusionCore.Messaging.Topic.TopicListeners.AddPriorityTopicListener ( string  topicName,
ITopicListener  listener 
)

Add a listener to the map of priority listeners.

Such listeners can be added only by topic name and not by selector as they are only used for command topic handlers.

Parameters
topicName
listener
void PushTechnology.DiffusionCore.Messaging.Topic.TopicListeners.AddTopicListener ( ITopicListener  listener,
TopicSet  topicSet,
bool  hasPriority = false 
)

Add a topic listener for a TopicSet.

Parameters
listenerThe listener.
topicSetThe topic patterns.
hasPriorityDetermines whether this topic listener should be placed at the beginning of the list.
void PushTechnology.DiffusionCore.Messaging.Topic.TopicListeners.AddTopicListener ( ITopicListener  listener,
bool  hasPriority = false,
params string[]  topicPatterns 
)

Add a topic listener for one or more patterns.

Parameters
listenerThe listener.
hasPriorityDetermines whether this topic listener should be placed at the beginning of the list.
topicPatternsThe patterns.
void PushTechnology.DiffusionCore.Messaging.Topic.TopicListeners.ClearCache ( )

Clear the cache.

bool PushTechnology.DiffusionCore.Messaging.Topic.TopicListeners.NotifyListeners ( IMessageSource  messageSource,
ITopicMessage  message 
)

Notify all listeners that apply to the logic of the supplied message.

Parameters
messageSourceThe source of the message.
messageThe message.
Returns
True if the message was consumed and should not be passed on to any more listeners.
bool PushTechnology.DiffusionCore.Messaging.Topic.TopicListeners.RemoveTopicListener ( ITopicListener  topicListener)

Removes a topic listener.

This searches the selector to listener map for any occurrence that points to the listener and removes it. It also updates the cache accordingly.

Parameters
topicListenerThe listener to remove.
Returns
true if removed.
void PushTechnology.DiffusionCore.Messaging.Topic.TopicListeners.TopicDeleted ( string  topicName)

Notifies the deletion of a topic.

This is called on deletion of every topic.

Parameters
topicNameThe full name of the deleted topic.

Implements PushTechnology.DiffusionCore.Messaging.Topic.ITopicDeletionListener.

override string PushTechnology.DiffusionCore.Messaging.Topic.TopicListeners.ToString ( )

Returns a human-readable string form of this object.

Returns

Property Documentation

bool PushTechnology.DiffusionCore.Messaging.Topic.TopicListeners.HasTopicListeners
getset

Flag to see if we are actually using topic listeners and thus saving time if we are not.