search: keywords: ['java', 'olivequeryresultlistener', 'live query']

OLiveQueryResultListener

Interface provides a listener interface for live queries.

Using Live Query Listeners

In OrientDB, Live Queries allows you to execute code in response to changes on the database. It has two parts, a query that defines the records you want to monitor and a listener that controls what your application does in response to changes in these records. Using this interface, you can implement your own listener with the specific code you want to run in response to changes.

To use OLiveQueryListener in your application, import it into your code:

import com.orientechnologies.orient.core.db.OLiveQueryResultListener;

Methods

When your Live Query registers an event, such as a user running an UPDATE or DELETE statement, OrientDB attempts to call methods on the listener. You can define what actions your application takes by overriding the following methods, implementing your own code.

MethodDescription
onCreate()Executes on record creation
onDelete()Executes on record deletion
onEnd()Executes on unsubscribe
onError()Executes on errors
onUpdate()Executes on record updates