Interface LiveQuery


public interface LiveQuery
Live query is a query whose result is always kept updated. This interface allows retrieving the query result and tracking changes over the result. After getting the result for the first time, one can track changes over this query result, using the hasChanges and getChanges methods.
  • Method Details

    • getName

      String getName()
      The name of the query.
    • getQueryResult

      LiveTopology getQueryResult() throws UcmdbException
      Gets the result of the query.
      Returns:
      Topology with version that allows to track changes in the query result
      Throws:
      UcmdbException
      Since:
      9.0
      See Also:
    • hasChanges

      boolean hasChanges(QueryResultVersion queryResultVersion) throws UcmdbException
      Determines whether there are changes in the result of the query since the result had the given result version.
      Parameters:
      queryResultVersion - the version of the result.
      Returns:
      true if there were changes.
      Throws:
      UcmdbException
    • getChanges

      returns the changes in the result of the query since the result had the given result version Notice that there may be cases where has changes returned true, but get changes will return empty changes since it accumulates changes, for example, if certain object was added and than was removed
      Parameters:
      queryResultVersion -
      Returns:
      the changes in the result of the query since the result had the given result version
      Throws:
      FullSyncRequiredException
      UcmdbException
    • setMaxChunkSize

      void setMaxChunkSize(int maxChunkSize)
      Defines a limit for maximum elements per chunk from getQueryResult. If the result is larger than this limit, query the LiveTopology as to whether there are more chunks, and retrieve these chunks using getNextChunk.
    • withDataIntegrityRulesBundle

      @NotFinalAPI LiveQuery withDataIntegrityRulesBundle(String dataIntegrityRulesBundle)
    • setChunkKeepingPeriod

      void setChunkKeepingPeriod(int chunkKeepingPeriodInSeconds)
      Defines the time that a chunk is available. After this time period, the chunk is disposed of.
      Parameters:
      chunkKeepingPeriodInSeconds - time to keep the chunk in seconds
    • setQueryResultListener

      @NotFinalAPI void setQueryResultListener(LiveQueryResultListener listener)
      Registers a listener to be called when the result of the query changes. There may be a delay of several minutes between the change in topology and the notification. The length of the delay depends on the query's priority and other factors.
      Parameters:
      listener - client-side implementation of the listener interface
      Since:
      9.0
    • removeQueryResultListener

      @NotFinalAPI LiveQueryResultListener removeQueryResultListener() throws UcmdbException
      Unregisters live query listener.
      Throws:
      UcmdbException
      Since:
      9.0