Search in sources :

Example 1 with QueryStreamSubscriber

use of io.confluent.ksql.rest.integration.QueryStreamSubscriber in project ksql by confluentinc.

the class ScalablePushBandwidthThrottleIntegrationTest method makeRequestAndSetupSubscriber.

private void makeRequestAndSetupSubscriber(final String sql, final Map<String, ?> properties, final CompletableFuture<StreamedRow> header, final CompletableFuture<List<StreamedRow>> future) {
    publisher = makeQueryRequest(sql, properties);
    subscriber = new QueryStreamSubscriber(publisher.getContext(), future, header);
    publisher.subscribe(subscriber);
}
Also used : QueryStreamSubscriber(io.confluent.ksql.rest.integration.QueryStreamSubscriber)

Example 2 with QueryStreamSubscriber

use of io.confluent.ksql.rest.integration.QueryStreamSubscriber in project ksql by confluentinc.

the class RestTestExecutor method handleRowPublisher.

private Optional<List<StreamedRow>> handleRowPublisher(final StreamPublisher<StreamedRow> publisher, final InputConditionsParameters inputConditionsParameters) {
    final CompletableFuture<List<StreamedRow>> future = new CompletableFuture<>();
    final CompletableFuture<StreamedRow> header = new CompletableFuture<>();
    final QueryStreamSubscriber subscriber = new QueryStreamSubscriber(publisher.getContext(), future, header);
    publisher.subscribe(subscriber);
    try {
        header.get();
        inputConditionsParameters.getWaitForInputConditionsToBeMet().run();
        inputConditionsParameters.getAfterInputConditions().run();
        return Optional.of(future.get());
    } catch (Exception e) {
        LOG.error("Error waiting on header, calling afterHeader, or waiting on rows", e);
        throw new AssertionError(e);
    } finally {
        subscriber.close();
        publisher.close();
    }
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) StreamedRow(io.confluent.ksql.rest.entity.StreamedRow) List(java.util.List) KsqlEntityList(io.confluent.ksql.rest.entity.KsqlEntityList) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) KsqlException(io.confluent.ksql.util.KsqlException) KsqlServerException(io.confluent.ksql.util.KsqlServerException) QueryStreamSubscriber(io.confluent.ksql.rest.integration.QueryStreamSubscriber)

Example 3 with QueryStreamSubscriber

use of io.confluent.ksql.rest.integration.QueryStreamSubscriber in project ksql by confluentinc.

the class ScalablePushBandwidthThrottleIntegrationTest method makeRequestAndSetupSubscriberAsync.

private void makeRequestAndSetupSubscriberAsync(final String sql, final Map<String, ?> properties, final CompletableFuture<StreamedRow> header, final CompletableFuture<List<StreamedRow>> future) throws ExecutionException, InterruptedException {
    publisher = makeQueryRequestAsync(sql, properties);
    subscriber = new QueryStreamSubscriber(publisher.getContext(), future, header);
    publisher.subscribe(subscriber);
}
Also used : QueryStreamSubscriber(io.confluent.ksql.rest.integration.QueryStreamSubscriber)

Aggregations

QueryStreamSubscriber (io.confluent.ksql.rest.integration.QueryStreamSubscriber)3 ImmutableList (com.google.common.collect.ImmutableList)1 KsqlEntityList (io.confluent.ksql.rest.entity.KsqlEntityList)1 StreamedRow (io.confluent.ksql.rest.entity.StreamedRow)1 KsqlException (io.confluent.ksql.util.KsqlException)1 KsqlServerException (io.confluent.ksql.util.KsqlServerException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 CompletableFuture (java.util.concurrent.CompletableFuture)1