Interface Event
-
- All Superinterfaces:
Comparable<Event>
,Serializable
- All Known Implementing Classes:
BaselineChangedEvent
,BaselineConfigurationChangedEvent
,CacheConsistencyViolationEvent
,CacheEvent
,CacheObjectTransformedEvent
,CacheQueryExecutedEvent
,CacheQueryReadEvent
,CacheRebalancingEvent
,CheckpointEvent
,ClusterActivationEvent
,ClusterStateChangeEvent
,ClusterStateChangeStartedEvent
,ClusterTagUpdatedEvent
,DeploymentEvent
,DiscoveryEvent
,EventAdapter
,JobEvent
,NodeValidationFailedEvent
,PageReplacementStartedEvent
,SnapshotEvent
,SqlQueryExecutionEvent
,TaskEvent
,TransactionStateChangedEvent
,WalSegmentArchivedEvent
,WalSegmentCompactedEvent
public interface Event extends Comparable<Event>, Serializable
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...)
- 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).
Events and Performance
Note that by default all events in Ignite are enabled and therefore generated and stored by whatever event storage SPI is configured. Ignite can and often does generate thousands events per seconds under the load and therefore it creates a significant additional load on the system. If these events are not needed by the application this load is unnecessary and leads to significant performance degradation.It is highly recommended to enable only those events that your application logic requires by using either
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.Internal and Hidden Events
Also note that some events are considered to be internally used or hidden.Internally used events are always "recordable" for notification purposes (regardless of whether they were enabled or disabled). But won't be sent down to SPI level if user specifically excluded them.
All discovery events are internal:
EventType.EVT_NODE_FAILED
EventType.EVT_NODE_LEFT
EventType.EVT_NODE_JOINED
EventType.EVT_NODE_METRICS_UPDATED
EventType.EVT_NODE_SEGMENTED
Hidden events are NEVER sent to SPI level. They serve purpose of local notification for the local node.
Hidden events:
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IgniteUuid
id()
Gets globally unique ID of this event.long
localOrder()
Gets locally unique ID that is atomically incremented for each event.@Nullable String
message()
Gets optional message for this event.String
name()
Gets name of this event.ClusterNode
node()
Node where event occurred and was recordedString
shortDisplay()
Gets a shortened version oftoString()
result.long
timestamp()
Gets event timestamp.int
type()
Gets type of this event.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
id
IgniteUuid id()
Gets globally unique ID of this event.- Returns:
- Globally unique ID of this event.
- See Also:
localOrder()
-
localOrder
long localOrder()
Gets locally unique ID that is atomically incremented for each event. Unlike globalid()
this local ID can be used for ordering events on this node.Note that for performance considerations Ignite doesn't order events globally.
- Returns:
- Locally unique ID that is atomically incremented for each new event.
- See Also:
id()
-
node
ClusterNode node()
Node where event occurred and was recorded- Returns:
- node where event occurred and was recorded.
-
message
@Nullable @Nullable String message()
Gets optional message for this event.- Returns:
- Optional (can be
null
) message for this event.
-
type
int type()
Gets type of this event. All system event types are defined inEventType
.NOTE: all types in range from 1 to 1000 are reserved for internal Ignite events and should not be used by user-defined events.
- Returns:
- Event's type.
- See Also:
EventType
-
name
String name()
Gets name of this event. All events are defined inEventType
class.- Returns:
- Name of this event.
-
timestamp
long timestamp()
Gets event timestamp. Timestamp is local to the node on which this event was produced. Note that more than one event can be generated with the same timestamp. For ordering purposes uselocalOrder()
instead.- Returns:
- Event timestamp.
-
shortDisplay
String shortDisplay()
Gets a shortened version oftoString()
result. Suitable for humans to read.- Returns:
- Shortened version of
toString()
result.
-
-