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

io.inverno.mod.grpc.server.GrpcExchange Maven / Gradle / Ivy

There is a newer version: 1.12.0
Show newest version
/*
 * Copyright 2024 Jeremy Kuhn
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.inverno.mod.grpc.server;

import com.google.protobuf.Message;
import io.inverno.mod.grpc.base.GrpcBaseExchange;
import io.inverno.mod.grpc.base.GrpcStatus;
import io.inverno.mod.http.base.ExchangeContext;
import io.inverno.mod.http.server.ExchangeHandler;

/**
 * 

* Represents a gRPC server exchange between a client and a server. *

* *

* A server gRPC exchange is created in a specific {@link ExchangeHandler} provided by the {@link GrpcServer} which basically converts an HTTP server exchange into one of * {@link GrpcExchange.Unary}, {@link GrpcExchange.ClientStreaming}, {@link GrpcExchange.ServerStreaming} or {@link GrpcExchange.BidirectionalStreaming} exchange which reflect the four kinds of * service method defined by gRPC core concepts. The exchange handler then delegates the processing of the exchange to the * {@link GrpcExchangeHandler} which was initialy provided to the {@link GrpcServer}. *

* *

* The server exchange terminates when the response message publisher terminates, gRPC metadata are then sent to the client with final {@link GrpcStatus}. *

* * @author Jeremy Kuhn * @since 1.9 * * @param The exchange context type * @param The request message type * @param The response message type * @param the request type * @param the response type */ public interface GrpcExchange, E extends GrpcResponse> extends GrpcBaseExchange { /** *

* Represents a unary (request/response) server gRPC exchange. *

* * @author
Jeremy Kuhn * @since 1.9 * * @param The exchange context type * @param The request message type * @param The response message type */ interface Unary extends GrpcExchange, GrpcResponse.Unary> { } /** *

* Represents a client streaming (stream/response) server gRPC exchange. *

* * @author
Jeremy Kuhn * @since 1.9 * * @param The exchange context type * @param The request message type * @param The response message type */ interface ClientStreaming extends GrpcExchange, GrpcResponse.Unary> { } /** *

* Represents a server streaming (request/stream) server gRPC exchange. *

* * @author
Jeremy Kuhn * @since 1.9 * * @param The exchange context type * @param The request message type * @param The response message type */ interface ServerStreaming extends GrpcExchange, GrpcResponse.Streaming> { } /** *

* Represents a bidirectional streaming (stream/stream) server gRPC exchange. *

* * @author
Jeremy Kuhn * @since 1.9 * * @param The exchange context type * @param The request message type * @param The response message type */ interface BidirectionalStreaming extends GrpcExchange, GrpcResponse.Streaming> { } }