Skip to content

QueryEndpoint

QueryEndpoint is used to create a QueryPublisher for KsqlServerEndpoints.

Creating Instance

QueryEndpoint takes the following to be created:

QueryEndpoint is created when:

KsqlEngine

QueryEndpoint is given a KsqlEngine when created.

The KsqlEngine is used when configuring a query statement (to parse and prepare a KSQL query statement).

QueryExecutor

QueryEndpoint is given a QueryExecutor when created.

The QueryExecutor is used for createQueryPublisher (to handle a configured KSQL query statement).

Creating QueryPublisher

QueryPublisher createQueryPublisher(
  String sql,
  Map<String, Object> properties,
  Map<String, Object> sessionVariables,
  Map<String, Object> requestProperties,
  Context context,
  WorkerExecutor workerExecutor,
  ServiceContext serviceContext,
  MetricsCallbackHolder metricsCallbackHolder,
  Optional<Boolean> isInternalRequest)

createQueryPublisher creates a ConfiguredStatement for the given sql (that is expected to be a Query statement).

createQueryPublisher requests the QueryExecutor to handle the query statement.

For a pull query result, createQueryPublisher creates a BlockingQueryPublisher to setQueryHandle with a new KsqlPullQueryHandle and the flags:

  • isPullQuery enabled
  • isScalablePushQuery disabled

For a push query result, createQueryPublisher creates a BlockingQueryPublisher to setQueryHandle with a new KsqlQueryHandle and the flags:

  • isPullQuery disabled
  • isScalablePushQuery based on whether QueryMetadataHolder holds a ScalablePushQueryMetadata or not

Otherwise, createQueryPublisher throws an KsqlStatementException:

Unexpected metadata for query

createQueryPublisher is used when: