com.streambase.liveview.client

## Interface QueryListener

- All Superinterfaces:
    EventListener
  All Known Implementing Classes:
    AbstractBatchedQueryListener, AbstractQueryListener, CompositeQueryListener, DeleteQueryListener, LiveResult, QueryListenerWrapper, SnapshotQueryListener

      public interface QueryListener
      extends EventListener

  A query listener interface must be provided when registering a query. The server will make call backs to this interface with query events. If you are only interested in a subset of events consider using the `AbstractQueryListener`.

  All tuple events between `QueryListener.snapshotBegin(BeginSnapshotEvent)` and `QueryListener.snapshotEnd(EndSnapshotEvent)` are `QueryListener.tupleAdded(TupleAddedEvent)` events.

  If the `LiveViewQueryType` of the query is SNAPSHOT_AND_CONTINUOUS, then the QueryListener after the `QueryListener.snapshotEnd(EndSnapshotEvent)` can receive any number of `QueryListener.tupleAdded(TupleAddedEvent)`, `QueryListener.tupleUpdated(TupleUpdatedEvent)`, and `QueryListener.tupleRemoved(TupleRemovedEvent)`, in any order.

  It is also possible that the query results will need to be reset, in which case the QueryListener might receive a new `QueryListener.snapshotBegin(BeginSnapshotEvent)`. This signals that all previous data should be discarded, and the entire process will start fresh. For example, if the query was made through a `LiveViewMultiConnection`, and the server that was servicing the query has gone down, and a new server has since picked the connection back up, the `QueryListener.snapshotBegin(BeginSnapshotEvent)` will signal the beginning of a new result set coming from the new server.

  At any point the QueryListener might receive a `QueryListener.exceptionRaised(QueryExceptionEvent)`, if some unrecoverable failure has happened. In that case, the query will be closed and no more TupleEvents will happen. If `QueryListener.snapshotEnd(EndSnapshotEvent)` has not yet been called, it won't be. The exception will be the final callback made to the QueryListener.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default void` | `aggMarkBegin(BeginAggMarkEvent event)` Event to indicate that the set of aggregation results may be changing so some results may be from an older generation while other may be from a newer one.
    `default void` | `aggMarkEnd(EndAggMarkEvent event)` Event to indicate that the set of aggregation results since the last aggMarkBegin event are now consistent and will not change until the next aggMarkBegin.
    `void` | `deleteBegin(BeginDeleteEvent event)` Event to indicate the start of delete query.
    `void` | `deleteEnd(EndDeleteEvent event)` Event to indicate the delete query is complete.
    `void` | `exceptionRaised(QueryExceptionEvent event)` Event when an exception occurs during the query.
    `void` | `queryClosed(QueryClosedEvent event)` Event when a query being listened to is closed.
    `void` | `snapshotBegin(BeginSnapshotEvent event)` Event to indicate the start of the result snapshot.
    `void` | `snapshotEnd(EndSnapshotEvent event)` Event to indicate the query snapshot is complete.
    `void` | `tupleAdded(TupleAddedEvent event)` Event when a new tuple is added to the result.
    `void` | `tupleRemoved(TupleRemovedEvent event)` Event when an existing tuple is removed from the result.
    `void` | `tupleUpdated(TupleUpdatedEvent event)` Event when an existing tuple in the result is updated.

- - ### Method Detail

    - #### tupleAdded

          void tupleAdded(TupleAddedEvent event)

      Event when a new tuple is added to the result.
      Parameters:
        `event` - add event

    - #### tupleUpdated

          void tupleUpdated(TupleUpdatedEvent event)

      Event when an existing tuple in the result is updated.
      Parameters:
        `event` - update event

    - #### tupleRemoved

          void tupleRemoved(TupleRemovedEvent event)

      Event when an existing tuple is removed from the result.
      Parameters:
        `event` - remove event

    - #### snapshotBegin

          void snapshotBegin(BeginSnapshotEvent event)

      Event to indicate the start of the result snapshot. This is the first method called when a query starts returning results, but this method is also called to indicate a reset (a complete restart of the query.)
      Parameters:
        `event` - snapshot begin

    - #### snapshotEnd

          void snapshotEnd(EndSnapshotEvent event)

      Event to indicate the query snapshot is complete.
      Parameters:
        `event` - snapshot end

    - #### deleteBegin

          void deleteBegin(BeginDeleteEvent event)

      Event to indicate the start of delete query.
      Parameters:
        `event` - delete begin
      Since:
        1.5.2

    - #### deleteEnd

          void deleteEnd(EndDeleteEvent event)

      Event to indicate the delete query is complete.
      Parameters:
        `event` - delete end
      Since:
        1.5.2

    - #### aggMarkEnd

          default void aggMarkEnd(EndAggMarkEvent event)

      Event to indicate that the set of aggregation results since the last aggMarkBegin event are now consistent and will not change until the next aggMarkBegin.
      Parameters:
        `end` - aggregate mark event
      Since:
        7.7.4

    - #### aggMarkBegin

          default void aggMarkBegin(BeginAggMarkEvent event)

      Event to indicate that the set of aggregation results may be changing so some results may be from an older generation while other may be from a newer one.
      Parameters:
        `begin` - aggregate mark event
      Since:
        7.7.4

    - #### exceptionRaised

          void exceptionRaised(QueryExceptionEvent event)

      Event when an exception occurs during the query. Since 1.3, reaching the row limit is considered an exception.
      Parameters:
        `event` - exception event
      Since:
        1.3 - this method will be invoked when the query row limit is reached (earlier versions would simply end streaming results)

    - #### queryClosed

          void queryClosed(QueryClosedEvent event)

      Event when a query being listened to is closed.
      Parameters:
        `event` - query closed event

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.