org.apache.ignite.events

## Class TaskEvent

- java.lang.Object
- - org.apache.ignite.events.EventAdapter
  - - org.apache.ignite.events.TaskEvent

- All Implemented Interfaces:
    Serializable, Comparable<Event>, Event

      public class TaskEvent
      extends EventAdapter

  Grid task event.

  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).
  User can also wait for events using method `IgniteEvents.waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)`.

  # 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 `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.

  See Also:
    `EventType.EVT_TASK_FAILED`, `EventType.EVT_TASK_FINISHED`, `EventType.EVT_TASK_REDUCED`, `EventType.EVT_TASK_STARTED`, `EventType.EVT_TASK_SESSION_ATTR_SET`, `EventType.EVT_TASK_TIMEDOUT`, `EventType.EVTS_TASK_EXECUTION`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TaskEvent(ClusterNode node, String msg, int type, IgniteUuid sesId, String taskName, String taskClsName, boolean internal, @Nullable UUID subjId)` Creates task event with given parameters.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `internal()` Returns `true` if task is created by Ignite and is used for system needs.
    `String` | `shortDisplay()` Gets a shortened version of `toString()` result.
    `@Nullable UUID` | `subjectId()` Gets security subject ID initiated this task event, if available.
    `String` | `taskClassName()` Gets name of task class that triggered this event.
    `String` | `taskName()` Gets name of the task that triggered the event.
    `IgniteUuid` | `taskSessionId()` Gets session ID of the task that triggered the event.
    `String` | `toString()`

    - ### Methods inherited from class org.apache.ignite.events.EventAdapter

      `compareTo, equals, hashCode, id, localOrder, message, message, name, node, node, timestamp, type, type`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TaskEvent

          public TaskEvent(ClusterNode node,
                           String msg,
                           int type,
                           IgniteUuid sesId,
                           String taskName,
                           String taskClsName,
                           boolean internal,
                           @Nullable
                           @Nullable UUID subjId)

      Creates task event with given parameters.
      Parameters:
        `node` - Node.
        `msg` - Optional message.
        `type` - Event type.
        `sesId` - Task session ID.
        `taskName` - Task name.
        `subjId` - Subject ID.

  - ### Method Detail

    - #### shortDisplay

          public String shortDisplay()

      Gets a shortened version of `toString()` result. Suitable for humans to read.
      Specified by:
        `shortDisplay` in interface `Event`
      Overrides:
        `shortDisplay` in class `EventAdapter`
      Returns:
        Shortened version of `toString()` result.

    - #### taskName

          public String taskName()

      Gets name of the task that triggered the event.
      Returns:
        Name of the task that triggered the event.

    - #### taskClassName

          public String taskClassName()

      Gets name of task class that triggered this event.
      Returns:
        Name of task class that triggered the event.

    - #### taskSessionId

          public IgniteUuid taskSessionId()

      Gets session ID of the task that triggered the event.
      Returns:
        Session ID of the task that triggered the event.

    - #### internal

          public boolean internal()

      Returns `true` if task is created by Ignite and is used for system needs.
      Returns:
        `True` if task is created by Ignite and is used for system needs.

    - #### subjectId

          @Nullable
          public @Nullable UUID subjectId()

      Gets security subject ID initiated this task event, if available. This property is not available for GridEventType#EVT_TASK_SESSION_ATTR_SET task event.

      Subject ID will be set either to node ID or client ID initiated task execution.

      Returns:
        Subject ID.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `EventAdapter`

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021