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

io.vertx.grpc.server.GrpcServerResponse Maven / Gradle / Ivy

/*
 * Copyright (c) 2011-2022 Contributors to the Eclipse Foundation
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
 * which is available at https://www.apache.org/licenses/LICENSE-2.0.
 *
 * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
 */
package io.vertx.grpc.server;

import io.vertx.codegen.annotations.Fluent;
import io.vertx.codegen.annotations.Nullable;
import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.MultiMap;
import io.vertx.core.streams.ReadStream;
import io.vertx.grpc.common.GrpcStatus;
import io.vertx.grpc.common.GrpcWriteStream;

@VertxGen
public interface GrpcServerResponse extends GrpcWriteStream {

  /**
   * Set the grpc status response
   *
   * @param status the status
   * @return a reference to this, so the API can be used fluently
   */
  @Fluent
  GrpcServerResponse status(GrpcStatus status);

  /**
   * Set the grpc status response message
   *
   * @param msg the message
   * @return a reference to this, so the API can be used fluently
   */
  @Fluent
  GrpcServerResponse statusMessage(String msg);

  @Fluent
  GrpcServerResponse encoding(String encoding);

  /**
   * @return the {@link MultiMap} to write metadata trailers
   */
  MultiMap trailers();

  @Override
  GrpcServerResponse exceptionHandler(@Nullable Handler handler);

  @Override
  GrpcServerResponse setWriteQueueMaxSize(int maxSize);

  @Override
  GrpcServerResponse drainHandler(@Nullable Handler handler);

  default Future send(Resp item) {
    return end(item);
  }

  default Future send(ReadStream body) {
    return body.pipeTo(this);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy