Interface IMessaging
Provides functionality for topic-based message exchange among nodes defined by IClusterGroup. Users can send ordered and unordered messages to various topics. Note that same topic name cannot be reused between ordered and unordered messages.
All members are thread-safe and may be used concurrently from multiple threads.
Namespace: Apache.Ignite.Core.Messaging
Assembly: Apache.Ignite.Core.dll
Syntax
public interface IMessaging
Properties
ClusterGroup
Gets the cluster group to which this instance belongs.
Declaration
IClusterGroup ClusterGroup { get; }
Property Value
Type | Description |
---|---|
IClusterGroup |
Methods
LocalListen<T>(IMessageListener<T>, Object)
Adds local listener for given topic on local node only. This listener will be notified whenever any node within the cluster group will send a message for a given topic to this node. Local listen subscription will happen regardless of whether local node belongs to this cluster group or not.
Declaration
void LocalListen<T>(IMessageListener<T> listener, object topic = null)
Parameters
Type | Name | Description |
---|---|---|
IMessageListener<T> | listener | Predicate that is called on each received message. If predicate returns false, then it will be unsubscribed from any further notifications. |
System.Object | topic | Topic to subscribe to. |
Type Parameters
Name | Description |
---|---|
T |
RemoteListen<T>(IMessageListener<T>, Object)
Adds a message listener for a given topic to all nodes in the cluster group (possibly including this node if it belongs to the cluster group as well). This means that any node within this cluster group can send a message for a given topic and all nodes within the cluster group will receive listener notifications.
Declaration
Guid RemoteListen<T>(IMessageListener<T> listener, object topic = null)
Parameters
Type | Name | Description |
---|---|---|
IMessageListener<T> | listener | Predicate that is called on each received message. If predicate returns false, then it will be unsubscribed from any further notifications. |
System.Object | topic | Topic to unsubscribe from. |
Returns
Type | Description |
---|---|
Guid | Operation ID that can be passed to StopRemoteListen(Guid) method to stop listening. |
Type Parameters
Name | Description |
---|---|
T |
RemoteListenAsync<T>(IMessageListener<T>, Object)
Adds a message listener for a given topic to all nodes in the cluster group (possibly including this node if it belongs to the cluster group as well). This means that any node within this cluster group can send a message for a given topic and all nodes within the cluster group will receive listener notifications.
Declaration
Task<Guid> RemoteListenAsync<T>(IMessageListener<T> listener, object topic = null)
Parameters
Type | Name | Description |
---|---|---|
IMessageListener<T> | listener | Predicate that is called on each received message. If predicate returns false, then it will be unsubscribed from any further notifications. |
System.Object | topic | Topic to unsubscribe from. |
Returns
Type | Description |
---|---|
Task<Guid> | Operation ID that can be passed to StopRemoteListen(Guid) method to stop listening. |
Type Parameters
Name | Description |
---|---|
T |
Send(Object, Object)
Sends a message with specified topic to the nodes in the underlying cluster group.
Declaration
void Send(object message, object topic = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | message | Message to send. |
System.Object | topic | Topic to send to, null for default topic. |
SendAll(IEnumerable, Object)
Sends messages with specified topic to the nodes in the underlying cluster group.
Declaration
void SendAll(IEnumerable messages, object topic = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable | messages | Messages to send. |
System.Object | topic | Topic to send to, null for default topic. |
SendOrdered(Object, Object, Nullable<TimeSpan>)
Sends a message with specified topic to the nodes in the underlying cluster group. Messages sent with this method will arrive in the same order they were sent. Note that if a topic is used for ordered messages, then it cannot be reused for non-ordered messages.
Declaration
void SendOrdered(object message, object topic = null, TimeSpan? timeout = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | message | Message to send. |
System.Object | topic | Topic to send to, null for default topic. |
System.Nullable<TimeSpan> | timeout | Message timeout, null for for default value from configuration (IgniteConfiguration.getNetworkTimeout). |
StopLocalListen<T>(IMessageListener<T>, Object)
Unregisters local listener for given topic on local node only.
Declaration
void StopLocalListen<T>(IMessageListener<T> listener, object topic = null)
Parameters
Type | Name | Description |
---|---|---|
IMessageListener<T> | listener | Listener predicate. |
System.Object | topic | Topic to unsubscribe from. |
Type Parameters
Name | Description |
---|---|
T |
StopRemoteListen(Guid)
Unregisters all listeners identified with provided operation ID on all nodes in the cluster group.
Declaration
void StopRemoteListen(Guid opId)
Parameters
Type | Name | Description |
---|---|---|
Guid | opId | Operation ID that was returned from RemoteListen<T>(IMessageListener<T>, Object) method. |
StopRemoteListenAsync(Guid)
Unregisters all listeners identified with provided operation ID on all nodes in the cluster group.
Declaration
Task StopRemoteListenAsync(Guid opId)
Parameters
Type | Name | Description |
---|---|---|
Guid | opId | Operation ID that was returned from RemoteListen<T>(IMessageListener<T>, Object) method. |
Returns
Type | Description |
---|---|
Task |