org.apache.ignite.events

## Class CacheQueryReadEvent<K,V>

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

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

      public class CacheQueryReadEvent<K,V>
      extends EventAdapter

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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CacheQueryReadEvent(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, K key, V val, V oldVal, @Nullable Object row)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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.
    `K` | `key()` Gets read entry key.
    `V` | `oldValue()` Gets read entry old value (applicable for continuous queries).
    `String` | `queryType()` Gets query type.
    `@Nullable Object` | `row()` Gets read results set row.
    `@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()`
    `V` | `value()` Gets read entry value.

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

    - #### CacheQueryReadEvent

          public CacheQueryReadEvent(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,
                                     @Nullable
                                     K key,
                                     @Nullable
                                     V val,
                                     @Nullable
                                     V oldVal,
                                     @Nullable
                                     @Nullable Object row)

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

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

    - #### key

          @Nullable
          public K key()

      Gets read entry key.
      Returns:
        Key.

    - #### value

          @Nullable
          public V value()

      Gets read entry value.
      Returns:
        Value.

    - #### oldValue

          @Nullable
          public V oldValue()

      Gets read entry old value (applicable for continuous queries).
      Returns:
        Old value.

    - #### row

          @Nullable
          public @Nullable Object row()

      Gets read results set row.
      Returns:
        Result row.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `EventAdapter`

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022