public class DiscoveryEvent extends EventAdapter
Grid events are used for notification about what happens within the grid. Note that by design Ignite keeps all events generated on the local node locally and it provides APIs for performing a distributed queries across multiple nodes:
IgniteEvents.remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)
-
asynchronously querying events occurred on the nodes specified, including remote nodes.
IgniteEvents.localQuery(org.apache.ignite.lang.IgnitePredicate, int...)
-
querying only local events stored on this local node.
IgniteEvents.localListen(org.apache.ignite.lang.IgnitePredicate, int...)
-
listening to local grid events (events from remote nodes not included).
IgniteEvents.waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)
.
It is highly recommended to enable only those events that your application logic requires
by using IgniteConfiguration.getIncludeEventTypes()
method in Ignite configuration.
Note that certain events are required for Ignite's internal operations and such events will still be generated but not stored by
event storage SPI if they are disabled in Ignite configuration.
Constructor and Description |
---|
DiscoveryEvent()
No-arg constructor.
|
DiscoveryEvent(ClusterNode node,
String msg,
int type,
ClusterNode evtNode)
Creates new discovery event with given parameters.
|
Modifier and Type | Method and Description |
---|---|
ClusterNode |
eventNode()
Gets node that caused this event to be generated.
|
void |
eventNode(ClusterNode evtNode)
Sets node this event is referring to.
|
@Nullable String |
message()
Gets optional message for this event.
|
void |
messageTemplate(String msgTemplate)
Template to generate
message() lazily. |
String |
shortDisplay()
Gets a shortened version of
toString() result. |
org.apache.ignite.internal.processors.tracing.Span |
span()
Gets span instance.
|
void |
span(org.apache.ignite.internal.processors.tracing.Span span)
Set span.
|
Collection<ClusterNode> |
topologyNodes()
Gets topology nodes from topology snapshot.
|
void |
topologySnapshot(long topVer,
Collection<ClusterNode> topSnapshot)
Sets the topology snapshot.
|
long |
topologyVersion()
Gets topology version if this event is raised on
topology change and configured discovery SPI implementation
supports topology versioning.
|
String |
toString() |
public DiscoveryEvent()
public DiscoveryEvent(ClusterNode node, String msg, int type, ClusterNode evtNode)
node
- Local node.msg
- Optional event message.type
- Event type.evtNode
- Node that caused this event to be generated.public String shortDisplay()
toString()
result. Suitable for humans to read.shortDisplay
in interface Event
shortDisplay
in class EventAdapter
toString()
result.public void eventNode(ClusterNode evtNode)
evtNode
- Event node.public ClusterNode eventNode()
A
locally recorded the event that a remote node
B
joined the topology. In this case this method will return node B
.public long topologyVersion()
0
if configured discovery SPI implementation
does not support versioning.public Collection<ClusterNode> topologyNodes()
public void topologySnapshot(long topVer, Collection<ClusterNode> topSnapshot)
topVer
- Topology version.topSnapshot
- Topology snapshot.public void messageTemplate(String msgTemplate)
message()
lazily. Will be joined with eventNode()
converted to string.msgTemplate
- Template.@Nullable public @Nullable String message()
message
in interface Event
message
in class EventAdapter
null
) message for this event.public org.apache.ignite.internal.processors.tracing.Span span()
public void span(org.apache.ignite.internal.processors.tracing.Span span)
span
- Span.public String toString()
toString
in class EventAdapter
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023