All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.stargate.grpc.service.streaming.StreamingBatchHandler Maven / Gradle / Ivy

There is a newer version: 2.1.0-BETA-19
Show newest version
package io.stargate.grpc.service.streaming;

import io.stargate.db.Persistence;
import io.stargate.grpc.service.BatchHandler;
import io.stargate.grpc.service.ExceptionHandler;
import io.stargate.grpc.service.StreamingSuccessHandler;
import io.stargate.proto.QueryOuterClass;

/**
 * Handles the response for Batch queries, constructs the {@link
 * io.stargate.proto.QueryOuterClass.StreamingResponse} for the {@link
 * io.stargate.proto.QueryOuterClass.Response}. Finally, invokes the {@link StreamingSuccessHandler}
 * for it.
 */
public class StreamingBatchHandler extends BatchHandler {
  private final StreamingSuccessHandler streamingSuccessHandler;

  StreamingBatchHandler(
      QueryOuterClass.Batch batch,
      Persistence.Connection connection,
      Persistence persistence,
      StreamingSuccessHandler streamingSuccessHandler,
      ExceptionHandler exceptionHandler) {
    super(batch, connection, persistence, exceptionHandler);
    this.streamingSuccessHandler = streamingSuccessHandler;
  }

  @Override
  protected void setSuccess(QueryOuterClass.Response response) {
    streamingSuccessHandler.handleResponse(
        QueryOuterClass.StreamingResponse.newBuilder().setResponse(response).build());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy