I want to emit a user defined Ignite event but haven't found any examples or implementations other than the Ignite sources, which uses non-API methods.
Can someone explain how to do this?
TIA
Updated with respect to the latest replies:
There is a set of predefined EventTypes
and you can't add a new one or embed a custom logic inside Ignite's internals without recompiling the sources which is too complex and impractical from my point of view.
As an alternative, you can use the Ignite Messaging.
Ignite ignite = Ignition.ignite();
IgniteMessaging rmtMsg = ignite.message(ignite.cluster().forRemotes());
// Add listener for ordered messages on all remote nodes.
rmtMsg.remoteListen("MyOrderedTopic", (nodeId, msg) -> {
System.out.println("Received ordered message [msg=" + msg + ", from=" + nodeId + ']');
return true; // Return true to continue listening.
});
// Send ordered messages to remote nodes.
for (int i = 0; i < 10; i++)
rmtMsg.sendOrdered("MyOrderedTopic", Integer.toString(i), 0);
Check these examples and the documentation.
After re-reading the docs i found a useful hint.
The brief description of recordLocal(Event evt)
:
After browsing the details i recognised the hint (marked in red)
So for local events "record" means "store and publish". It's somehow misleading ... but hey, it works :-)