Provides functionality for topic-based message exchange among nodes defined by
Users can send ordered and unordered messages to various topics. Note that same topic name
cannot be reused between ordered and unordered messages.
IgniteMessaging is obtained from
Ignite as follows:
Ignite ignite = Ignition.ignite();
// Messaging instance spanning all cluster nodes.
IgniteMessaging m = ignite.message();
You can also obtain an instance of messaging facade over a specific cluster group:
// Cluster group over remote nodes (excluding the local node).
ClusterGroup remoteNodes = ignite.cluster().forRemotes();
// Messaging instance spanning all remote cluster nodes.
IgniteMessaging m = ignite.message(remoteNodes);
2 ways to subscribe to message listening,
Local subscription, defined by
#localListen(Object,IgniteBiPredicate) method, will add
a listener for a given topic on local node only. This listener will be notified whenever any
node within the underlying cluster group will send a message for a given topic to this node. Local listen
subscription will happen regardless of whether the local node belongs to this cluster group or not.
Remote subscription, defined by
#remoteListen(Object,IgniteBiPredicate), will add a
message listener for a given topic to all nodes in the underlying 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.
Ordered vs Unordered
Ignite allows for sending ordered messages (see
messages will be received in the same order they were sent. Ordered messages have a
timeoutparameter associated with them which specifies how long an out-of-order message will stay in a queue,
waiting for messages that are ordered ahead of it to arrive. If timeout expires, then all ordered
messages for a given topic that have not arrived yet will be skipped. When (and if) expired messages
actually do arrive, they will be ignored.