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 snapshotBegin(BeginSnapshotEvent) and snapshotEnd(EndSnapshotEvent) are tupleAdded(TupleAddedEvent) events.

If the LiveViewQueryType of the query is SNAPSHOT_AND_CONTINUOUS, then the QueryListener after the snapshotEnd(EndSnapshotEvent) can receive any number of tupleAdded(TupleAddedEvent), tupleUpdated(TupleUpdatedEvent), and 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 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 snapshotBegin(BeginSnapshotEvent) will signal the beginning of a new result set coming from the new server.

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

Note that callbacks should return quickly. In some situations, long running callbacks can trigger heartbeat failures and/or other connection problems, particularly in the face of high data rates.