Package org.apache.ignite.events

## Class CacheQueryExecutedEvent<K,​V>

- java.lang.Object
- - org.apache.ignite.events.EventAdapter
  - - org.apache.ignite.events.CacheQueryExecutedEvent<K,​V>

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

      public class CacheQueryExecutedEvent<K,​V>
      extends EventAdapter

  Cache query execution 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_CACHE_QUERY_EXECUTED`, `EventType.EVTS_CACHE_QUERY`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CacheQueryExecutedEvent​(ClusterNode node, String msg, int type, String qryType, @Nullable String cacheName, @Nullable String clsName, @Nullable String clause, @Nullable IgniteBiPredicate<K,​V> scanQryFilter, @Nullable CacheEntryEventSerializableFilter<K,​V> contQryFilter, @Nullable Object[] args, @Nullable UUID subjId, @Nullable String taskName)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `@Nullable Object[]` | `arguments()` | Gets query arguments.
    `@Nullable String` | `cacheName()` | Gets cache name on which query was executed.
    `@Nullable String` | `className()` | Gets queried class name.
    `@Nullable String` | `clause()` | Gets query clause.
    `@Nullable CacheEntryEventSerializableFilter<K,​V>` | `continuousQueryFilter()` | Gets continuous query filter.
    `String` | `queryType()` | Gets query type.
    `@Nullable IgniteBiPredicate<K,​V>` | `scanQueryFilter()` | Gets scan query filter.
    `@Nullable UUID` | `subjectId()` | Gets security subject ID.
    `@Nullable String` | `taskName()` | Gets the name of the task that executed the query (if any).
    `String` | `toString()`

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

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

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

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

- - ### Constructor Detail

    - #### CacheQueryExecutedEvent

          public CacheQueryExecutedEvent​(ClusterNode node,
                                         String msg,
                                         int type,
                                         String qryType,
                                         @Nullable
                                         @Nullable String cacheName,
                                         @Nullable
                                         @Nullable String clsName,
                                         @Nullable
                                         @Nullable String clause,
                                         @Nullable
                                         @Nullable IgniteBiPredicate<K,​V> scanQryFilter,
                                         @Nullable
                                         @Nullable CacheEntryEventSerializableFilter<K,​V> contQryFilter,
                                         @Nullable
                                         @Nullable Object[] args,
                                         @Nullable
                                         @Nullable UUID subjId,
                                         @Nullable
                                         @Nullable String taskName)

      Parameters:
        `node` - Node where event was fired.
        `msg` - Event message.
        `type` - Event type.
        `qryType` - Query type.
        `cacheName` - Cache name.
        `clsName` - Class name.
        `clause` - Clause.
        `scanQryFilter` - Scan query filter.
        `args` - Query arguments.
        `subjId` - Security subject ID.
        `contQryFilter` - Continuous query filter.
        `taskName` - Name of the task if event was caused by an operation initiated within task execution.

  - ### Method Detail

    - #### queryType

          public String queryType()

      Gets query type.
      Returns:
        Query type. Can be `"SQL"`, `"SQL_FIELDS"`, `"FULL_TEXT"`, `"SCAN"`, `"CONTINUOUS"` or `"SPI"`.

    - #### cacheName

          @Nullable
          public @Nullable String cacheName()

      Gets cache name on which query was executed.
      Returns:
        Cache name.

    - #### className

          @Nullable
          public @Nullable String className()

      Gets queried class name.

      Applicable for `SQL` and @{code full text} queries.

      Returns:
        Queried class name.

    - #### clause

          @Nullable
          public @Nullable String clause()

      Gets query clause.

      Applicable for `SQL`, `SQL fields` and @{code full text} queries.

      Returns:
        Query clause.

    - #### scanQueryFilter

          @Nullable
          public @Nullable IgniteBiPredicate<K,​V> scanQueryFilter()

      Gets scan query filter.

      Applicable for `scan` queries.

      Returns:
        Scan query filter.

    - #### continuousQueryFilter

          @Nullable
          public @Nullable CacheEntryEventSerializableFilter<K,​V> continuousQueryFilter()

      Gets continuous query filter.

      Applicable for `continuous` queries.

      Returns:
        Continuous query filter.

    - #### arguments

          @Nullable
          public @Nullable Object[] arguments()

      Gets query arguments.

      Applicable for `SQL` and `SQL fields` queries.

      Returns:
        Query arguments.

    - #### subjectId

          @Nullable
          public @Nullable UUID subjectId()

      Gets security subject ID.
      Returns:
        Subject ID if security is enabled, otherwise null.
      See Also:
        `IgniteSecurity.enabled()`

    - #### taskName

          @Nullable
          public @Nullable String taskName()

      Gets the name of the task that executed the query (if any).
      Returns:
        Task name.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `EventAdapter`