org.apache.ignite.events

## Interface Event

All Superinterfaces:
  Comparable<Event>, Serializable

All Known Implementing Classes:
  CacheEvent, CacheQueryExecutedEvent, CacheQueryReadEvent, CacheRebalancingEvent, CheckpointEvent, DeploymentEvent, DiscoveryCustomEvent, DiscoveryEvent, EventAdapter, IgfsEvent, JobEvent, SwapSpaceEvent, TaskEvent

    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:

- `EventType.EVT_NODE_METRICS_UPDATED`

See Also:
  `JobEvent`, `CacheEvent`, `CacheRebalancingEvent`, `SwapSpaceEvent`, `CheckpointEvent`, `DeploymentEvent`, `DiscoveryEvent`, `TaskEvent`, `IgniteEvents.waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)`

### Method Summary

Methods
`IgniteUuid` `id()` Gets globally unique ID of this event.
`long` `localOrder()` Gets locally unique ID that is atomically incremented for each event.
`String` `message()` Gets optional message for this event.
`String` `name()` Gets name of this event.
`ClusterNode` `node()` Node where event occurred and was recorded
`String` `shortDisplay()` Gets a shortened version of `toString()` 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 global `id()` 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
    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 in `EventType`.

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 in `EventType` 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 use `localOrder()` instead.

Returns:
  Event timestamp.

#### shortDisplay

    String shortDisplay()

Gets a shortened version of `toString()` result. Suitable for humans to read.

Returns:
  Shortened version of `toString()` result.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.7.0
Release Date | : August 1 2016