Package com.streambase.liveview.client
Interface QueryListener
- All Superinterfaces:
EventListener
- All Known Implementing Classes:
AbstractBatchedQueryListener,AbstractQueryListener,CompositeQueryListener,DeleteQueryListener,LiveResult,QueryListenerWrapper,SnapshotQueryListener
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.-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaggMarkBegin(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 voidaggMarkEnd(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.voiddeleteBegin(BeginDeleteEvent event) Event to indicate the start of delete query.voiddeleteEnd(EndDeleteEvent event) Event to indicate the delete query is complete.voidEvent when an exception occurs during the query.voidqueryClosed(QueryClosedEvent event) Event when a query being listened to is closed.voidsnapshotBegin(BeginSnapshotEvent event) Event to indicate the start of the result snapshot.voidsnapshotEnd(EndSnapshotEvent event) Event to indicate the query snapshot is complete.voidtupleAdded(TupleAddedEvent event) Event when a new tuple is added to the result.voidtupleRemoved(TupleRemovedEvent event) Event when an existing tuple is removed from the result.voidtupleUpdated(TupleUpdatedEvent event) Event when an existing tuple in the result is updated.
-
Method Details
-
tupleAdded
Event when a new tuple is added to the result.- Parameters:
event- add event
-
tupleUpdated
Event when an existing tuple in the result is updated.- Parameters:
event- update event
-
tupleRemoved
Event when an existing tuple is removed from the result.- Parameters:
event- remove event
-
snapshotBegin
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
Event to indicate the query snapshot is complete.- Parameters:
event- snapshot end
-
deleteBegin
Event to indicate the start of delete query.- Parameters:
event- delete begin- Since:
- 1.5.2
-
deleteEnd
Event to indicate the delete query is complete.- Parameters:
event- delete end- Since:
- 1.5.2
-
aggMarkEnd
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:
event- theEndAggMarkEvent- Since:
- 7.7.4
-
aggMarkBegin
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:
event- theBeginAggMarkEvent- Since:
- 7.7.4
-
exceptionRaised
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
Event when a query being listened to is closed.- Parameters:
event- query closed event
-