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);
}
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();
}
}
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);
}
Aggregations