Introducing super basic health check for cart service

- Generated C# proto implementation for grpc health check
- Moved all C# protos to a dedicated folder
- Implemented basic health checking to ping CartStore (which is Redis in default implementation)
- Base plumbing for health checks
This commit is contained in:
Simon Zeltser 2018-09-20 17:33:07 -07:00
parent 07d84cb6a1
commit ff66de0a91
10 changed files with 31 additions and 6771 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,922 +0,0 @@
// Copyright 2018 Google LLC
//
// 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.
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: demo.proto
// </auto-generated>
#pragma warning disable 1591
#region Designer generated code
using grpc = global::Grpc.Core;
namespace Hipstershop {
public static partial class CartService
{
static readonly string __ServiceName = "hipstershop.CartService";
static readonly grpc::Marshaller<global::Hipstershop.AddItemRequest> __Marshaller_AddItemRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.AddItemRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.Empty> __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.Empty.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.GetCartRequest> __Marshaller_GetCartRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.GetCartRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.Cart> __Marshaller_Cart = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.Cart.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.EmptyCartRequest> __Marshaller_EmptyCartRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.EmptyCartRequest.Parser.ParseFrom);
static readonly grpc::Method<global::Hipstershop.AddItemRequest, global::Hipstershop.Empty> __Method_AddItem = new grpc::Method<global::Hipstershop.AddItemRequest, global::Hipstershop.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"AddItem",
__Marshaller_AddItemRequest,
__Marshaller_Empty);
static readonly grpc::Method<global::Hipstershop.GetCartRequest, global::Hipstershop.Cart> __Method_GetCart = new grpc::Method<global::Hipstershop.GetCartRequest, global::Hipstershop.Cart>(
grpc::MethodType.Unary,
__ServiceName,
"GetCart",
__Marshaller_GetCartRequest,
__Marshaller_Cart);
static readonly grpc::Method<global::Hipstershop.EmptyCartRequest, global::Hipstershop.Empty> __Method_EmptyCart = new grpc::Method<global::Hipstershop.EmptyCartRequest, global::Hipstershop.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"EmptyCart",
__Marshaller_EmptyCartRequest,
__Marshaller_Empty);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Hipstershop.DemoReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of CartService</summary>
public abstract partial class CartServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.Empty> AddItem(global::Hipstershop.AddItemRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.Cart> GetCart(global::Hipstershop.GetCartRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.Empty> EmptyCart(global::Hipstershop.EmptyCartRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for CartService</summary>
public partial class CartServiceClient : grpc::ClientBase<CartServiceClient>
{
/// <summary>Creates a new client for CartService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public CartServiceClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for CartService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public CartServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected CartServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected CartServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::Hipstershop.Empty AddItem(global::Hipstershop.AddItemRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return AddItem(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.Empty AddItem(global::Hipstershop.AddItemRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_AddItem, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.Empty> AddItemAsync(global::Hipstershop.AddItemRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return AddItemAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.Empty> AddItemAsync(global::Hipstershop.AddItemRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_AddItem, null, options, request);
}
public virtual global::Hipstershop.Cart GetCart(global::Hipstershop.GetCartRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetCart(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.Cart GetCart(global::Hipstershop.GetCartRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetCart, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.Cart> GetCartAsync(global::Hipstershop.GetCartRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetCartAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.Cart> GetCartAsync(global::Hipstershop.GetCartRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetCart, null, options, request);
}
public virtual global::Hipstershop.Empty EmptyCart(global::Hipstershop.EmptyCartRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return EmptyCart(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.Empty EmptyCart(global::Hipstershop.EmptyCartRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_EmptyCart, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.Empty> EmptyCartAsync(global::Hipstershop.EmptyCartRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return EmptyCartAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.Empty> EmptyCartAsync(global::Hipstershop.EmptyCartRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_EmptyCart, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override CartServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new CartServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(CartServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_AddItem, serviceImpl.AddItem)
.AddMethod(__Method_GetCart, serviceImpl.GetCart)
.AddMethod(__Method_EmptyCart, serviceImpl.EmptyCart).Build();
}
}
public static partial class RecommendationService
{
static readonly string __ServiceName = "hipstershop.RecommendationService";
static readonly grpc::Marshaller<global::Hipstershop.ListRecommendationsRequest> __Marshaller_ListRecommendationsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.ListRecommendationsRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.ListRecommendationsResponse> __Marshaller_ListRecommendationsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.ListRecommendationsResponse.Parser.ParseFrom);
static readonly grpc::Method<global::Hipstershop.ListRecommendationsRequest, global::Hipstershop.ListRecommendationsResponse> __Method_ListRecommendations = new grpc::Method<global::Hipstershop.ListRecommendationsRequest, global::Hipstershop.ListRecommendationsResponse>(
grpc::MethodType.Unary,
__ServiceName,
"ListRecommendations",
__Marshaller_ListRecommendationsRequest,
__Marshaller_ListRecommendationsResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Hipstershop.DemoReflection.Descriptor.Services[1]; }
}
/// <summary>Base class for server-side implementations of RecommendationService</summary>
public abstract partial class RecommendationServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.ListRecommendationsResponse> ListRecommendations(global::Hipstershop.ListRecommendationsRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for RecommendationService</summary>
public partial class RecommendationServiceClient : grpc::ClientBase<RecommendationServiceClient>
{
/// <summary>Creates a new client for RecommendationService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public RecommendationServiceClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for RecommendationService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public RecommendationServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected RecommendationServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected RecommendationServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::Hipstershop.ListRecommendationsResponse ListRecommendations(global::Hipstershop.ListRecommendationsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ListRecommendations(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.ListRecommendationsResponse ListRecommendations(global::Hipstershop.ListRecommendationsRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ListRecommendations, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.ListRecommendationsResponse> ListRecommendationsAsync(global::Hipstershop.ListRecommendationsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ListRecommendationsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.ListRecommendationsResponse> ListRecommendationsAsync(global::Hipstershop.ListRecommendationsRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ListRecommendations, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override RecommendationServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new RecommendationServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(RecommendationServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_ListRecommendations, serviceImpl.ListRecommendations).Build();
}
}
public static partial class ProductCatalogService
{
static readonly string __ServiceName = "hipstershop.ProductCatalogService";
static readonly grpc::Marshaller<global::Hipstershop.Empty> __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.Empty.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.ListProductsResponse> __Marshaller_ListProductsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.ListProductsResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.GetProductRequest> __Marshaller_GetProductRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.GetProductRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.Product> __Marshaller_Product = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.Product.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.SearchProductsRequest> __Marshaller_SearchProductsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.SearchProductsRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.SearchProductsResponse> __Marshaller_SearchProductsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.SearchProductsResponse.Parser.ParseFrom);
static readonly grpc::Method<global::Hipstershop.Empty, global::Hipstershop.ListProductsResponse> __Method_ListProducts = new grpc::Method<global::Hipstershop.Empty, global::Hipstershop.ListProductsResponse>(
grpc::MethodType.Unary,
__ServiceName,
"ListProducts",
__Marshaller_Empty,
__Marshaller_ListProductsResponse);
static readonly grpc::Method<global::Hipstershop.GetProductRequest, global::Hipstershop.Product> __Method_GetProduct = new grpc::Method<global::Hipstershop.GetProductRequest, global::Hipstershop.Product>(
grpc::MethodType.Unary,
__ServiceName,
"GetProduct",
__Marshaller_GetProductRequest,
__Marshaller_Product);
static readonly grpc::Method<global::Hipstershop.SearchProductsRequest, global::Hipstershop.SearchProductsResponse> __Method_SearchProducts = new grpc::Method<global::Hipstershop.SearchProductsRequest, global::Hipstershop.SearchProductsResponse>(
grpc::MethodType.Unary,
__ServiceName,
"SearchProducts",
__Marshaller_SearchProductsRequest,
__Marshaller_SearchProductsResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Hipstershop.DemoReflection.Descriptor.Services[2]; }
}
/// <summary>Base class for server-side implementations of ProductCatalogService</summary>
public abstract partial class ProductCatalogServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.ListProductsResponse> ListProducts(global::Hipstershop.Empty request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.Product> GetProduct(global::Hipstershop.GetProductRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.SearchProductsResponse> SearchProducts(global::Hipstershop.SearchProductsRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for ProductCatalogService</summary>
public partial class ProductCatalogServiceClient : grpc::ClientBase<ProductCatalogServiceClient>
{
/// <summary>Creates a new client for ProductCatalogService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public ProductCatalogServiceClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for ProductCatalogService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public ProductCatalogServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected ProductCatalogServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected ProductCatalogServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::Hipstershop.ListProductsResponse ListProducts(global::Hipstershop.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ListProducts(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.ListProductsResponse ListProducts(global::Hipstershop.Empty request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ListProducts, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.ListProductsResponse> ListProductsAsync(global::Hipstershop.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ListProductsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.ListProductsResponse> ListProductsAsync(global::Hipstershop.Empty request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ListProducts, null, options, request);
}
public virtual global::Hipstershop.Product GetProduct(global::Hipstershop.GetProductRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetProduct(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.Product GetProduct(global::Hipstershop.GetProductRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetProduct, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.Product> GetProductAsync(global::Hipstershop.GetProductRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetProductAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.Product> GetProductAsync(global::Hipstershop.GetProductRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetProduct, null, options, request);
}
public virtual global::Hipstershop.SearchProductsResponse SearchProducts(global::Hipstershop.SearchProductsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return SearchProducts(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.SearchProductsResponse SearchProducts(global::Hipstershop.SearchProductsRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_SearchProducts, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.SearchProductsResponse> SearchProductsAsync(global::Hipstershop.SearchProductsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return SearchProductsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.SearchProductsResponse> SearchProductsAsync(global::Hipstershop.SearchProductsRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_SearchProducts, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override ProductCatalogServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new ProductCatalogServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(ProductCatalogServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_ListProducts, serviceImpl.ListProducts)
.AddMethod(__Method_GetProduct, serviceImpl.GetProduct)
.AddMethod(__Method_SearchProducts, serviceImpl.SearchProducts).Build();
}
}
public static partial class ShippingService
{
static readonly string __ServiceName = "hipstershop.ShippingService";
static readonly grpc::Marshaller<global::Hipstershop.GetQuoteRequest> __Marshaller_GetQuoteRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.GetQuoteRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.GetQuoteResponse> __Marshaller_GetQuoteResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.GetQuoteResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.ShipOrderRequest> __Marshaller_ShipOrderRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.ShipOrderRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.ShipOrderResponse> __Marshaller_ShipOrderResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.ShipOrderResponse.Parser.ParseFrom);
static readonly grpc::Method<global::Hipstershop.GetQuoteRequest, global::Hipstershop.GetQuoteResponse> __Method_GetQuote = new grpc::Method<global::Hipstershop.GetQuoteRequest, global::Hipstershop.GetQuoteResponse>(
grpc::MethodType.Unary,
__ServiceName,
"GetQuote",
__Marshaller_GetQuoteRequest,
__Marshaller_GetQuoteResponse);
static readonly grpc::Method<global::Hipstershop.ShipOrderRequest, global::Hipstershop.ShipOrderResponse> __Method_ShipOrder = new grpc::Method<global::Hipstershop.ShipOrderRequest, global::Hipstershop.ShipOrderResponse>(
grpc::MethodType.Unary,
__ServiceName,
"ShipOrder",
__Marshaller_ShipOrderRequest,
__Marshaller_ShipOrderResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Hipstershop.DemoReflection.Descriptor.Services[3]; }
}
/// <summary>Base class for server-side implementations of ShippingService</summary>
public abstract partial class ShippingServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.GetQuoteResponse> GetQuote(global::Hipstershop.GetQuoteRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.ShipOrderResponse> ShipOrder(global::Hipstershop.ShipOrderRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for ShippingService</summary>
public partial class ShippingServiceClient : grpc::ClientBase<ShippingServiceClient>
{
/// <summary>Creates a new client for ShippingService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public ShippingServiceClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for ShippingService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public ShippingServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected ShippingServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected ShippingServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::Hipstershop.GetQuoteResponse GetQuote(global::Hipstershop.GetQuoteRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetQuote(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.GetQuoteResponse GetQuote(global::Hipstershop.GetQuoteRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetQuote, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.GetQuoteResponse> GetQuoteAsync(global::Hipstershop.GetQuoteRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetQuoteAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.GetQuoteResponse> GetQuoteAsync(global::Hipstershop.GetQuoteRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetQuote, null, options, request);
}
public virtual global::Hipstershop.ShipOrderResponse ShipOrder(global::Hipstershop.ShipOrderRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ShipOrder(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.ShipOrderResponse ShipOrder(global::Hipstershop.ShipOrderRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ShipOrder, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.ShipOrderResponse> ShipOrderAsync(global::Hipstershop.ShipOrderRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ShipOrderAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.ShipOrderResponse> ShipOrderAsync(global::Hipstershop.ShipOrderRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ShipOrder, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override ShippingServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new ShippingServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(ShippingServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_GetQuote, serviceImpl.GetQuote)
.AddMethod(__Method_ShipOrder, serviceImpl.ShipOrder).Build();
}
}
public static partial class CurrencyService
{
static readonly string __ServiceName = "hipstershop.CurrencyService";
static readonly grpc::Marshaller<global::Hipstershop.Empty> __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.Empty.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.GetSupportedCurrenciesResponse> __Marshaller_GetSupportedCurrenciesResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.GetSupportedCurrenciesResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.ConversionRequest> __Marshaller_ConversionRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.ConversionRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.ConversionResponse> __Marshaller_ConversionResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.ConversionResponse.Parser.ParseFrom);
static readonly grpc::Method<global::Hipstershop.Empty, global::Hipstershop.GetSupportedCurrenciesResponse> __Method_GetSupportedCurrencies = new grpc::Method<global::Hipstershop.Empty, global::Hipstershop.GetSupportedCurrenciesResponse>(
grpc::MethodType.Unary,
__ServiceName,
"GetSupportedCurrencies",
__Marshaller_Empty,
__Marshaller_GetSupportedCurrenciesResponse);
static readonly grpc::Method<global::Hipstershop.ConversionRequest, global::Hipstershop.ConversionResponse> __Method_Convert = new grpc::Method<global::Hipstershop.ConversionRequest, global::Hipstershop.ConversionResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Convert",
__Marshaller_ConversionRequest,
__Marshaller_ConversionResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Hipstershop.DemoReflection.Descriptor.Services[4]; }
}
/// <summary>Base class for server-side implementations of CurrencyService</summary>
public abstract partial class CurrencyServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.GetSupportedCurrenciesResponse> GetSupportedCurrencies(global::Hipstershop.Empty request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.ConversionResponse> Convert(global::Hipstershop.ConversionRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for CurrencyService</summary>
public partial class CurrencyServiceClient : grpc::ClientBase<CurrencyServiceClient>
{
/// <summary>Creates a new client for CurrencyService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public CurrencyServiceClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for CurrencyService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public CurrencyServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected CurrencyServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected CurrencyServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::Hipstershop.GetSupportedCurrenciesResponse GetSupportedCurrencies(global::Hipstershop.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetSupportedCurrencies(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.GetSupportedCurrenciesResponse GetSupportedCurrencies(global::Hipstershop.Empty request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetSupportedCurrencies, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.GetSupportedCurrenciesResponse> GetSupportedCurrenciesAsync(global::Hipstershop.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetSupportedCurrenciesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.GetSupportedCurrenciesResponse> GetSupportedCurrenciesAsync(global::Hipstershop.Empty request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetSupportedCurrencies, null, options, request);
}
public virtual global::Hipstershop.ConversionResponse Convert(global::Hipstershop.ConversionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Convert(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.ConversionResponse Convert(global::Hipstershop.ConversionRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Convert, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.ConversionResponse> ConvertAsync(global::Hipstershop.ConversionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ConvertAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.ConversionResponse> ConvertAsync(global::Hipstershop.ConversionRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Convert, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override CurrencyServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new CurrencyServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(CurrencyServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_GetSupportedCurrencies, serviceImpl.GetSupportedCurrencies)
.AddMethod(__Method_Convert, serviceImpl.Convert).Build();
}
}
public static partial class PaymentService
{
static readonly string __ServiceName = "hipstershop.PaymentService";
static readonly grpc::Marshaller<global::Hipstershop.ChargeRequest> __Marshaller_ChargeRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.ChargeRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.ChargeResponse> __Marshaller_ChargeResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.ChargeResponse.Parser.ParseFrom);
static readonly grpc::Method<global::Hipstershop.ChargeRequest, global::Hipstershop.ChargeResponse> __Method_Charge = new grpc::Method<global::Hipstershop.ChargeRequest, global::Hipstershop.ChargeResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Charge",
__Marshaller_ChargeRequest,
__Marshaller_ChargeResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Hipstershop.DemoReflection.Descriptor.Services[5]; }
}
/// <summary>Base class for server-side implementations of PaymentService</summary>
public abstract partial class PaymentServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.ChargeResponse> Charge(global::Hipstershop.ChargeRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for PaymentService</summary>
public partial class PaymentServiceClient : grpc::ClientBase<PaymentServiceClient>
{
/// <summary>Creates a new client for PaymentService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public PaymentServiceClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for PaymentService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public PaymentServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected PaymentServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected PaymentServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::Hipstershop.ChargeResponse Charge(global::Hipstershop.ChargeRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Charge(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.ChargeResponse Charge(global::Hipstershop.ChargeRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Charge, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.ChargeResponse> ChargeAsync(global::Hipstershop.ChargeRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ChargeAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.ChargeResponse> ChargeAsync(global::Hipstershop.ChargeRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Charge, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override PaymentServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new PaymentServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(PaymentServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_Charge, serviceImpl.Charge).Build();
}
}
public static partial class EmailService
{
static readonly string __ServiceName = "hipstershop.EmailService";
static readonly grpc::Marshaller<global::Hipstershop.SendOrderConfirmationRequest> __Marshaller_SendOrderConfirmationRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.SendOrderConfirmationRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.Empty> __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.Empty.Parser.ParseFrom);
static readonly grpc::Method<global::Hipstershop.SendOrderConfirmationRequest, global::Hipstershop.Empty> __Method_SendOrderConfirmation = new grpc::Method<global::Hipstershop.SendOrderConfirmationRequest, global::Hipstershop.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"SendOrderConfirmation",
__Marshaller_SendOrderConfirmationRequest,
__Marshaller_Empty);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Hipstershop.DemoReflection.Descriptor.Services[6]; }
}
/// <summary>Base class for server-side implementations of EmailService</summary>
public abstract partial class EmailServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.Empty> SendOrderConfirmation(global::Hipstershop.SendOrderConfirmationRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for EmailService</summary>
public partial class EmailServiceClient : grpc::ClientBase<EmailServiceClient>
{
/// <summary>Creates a new client for EmailService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public EmailServiceClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for EmailService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public EmailServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected EmailServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected EmailServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::Hipstershop.Empty SendOrderConfirmation(global::Hipstershop.SendOrderConfirmationRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return SendOrderConfirmation(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.Empty SendOrderConfirmation(global::Hipstershop.SendOrderConfirmationRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_SendOrderConfirmation, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.Empty> SendOrderConfirmationAsync(global::Hipstershop.SendOrderConfirmationRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return SendOrderConfirmationAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.Empty> SendOrderConfirmationAsync(global::Hipstershop.SendOrderConfirmationRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_SendOrderConfirmation, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override EmailServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new EmailServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(EmailServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_SendOrderConfirmation, serviceImpl.SendOrderConfirmation).Build();
}
}
public static partial class CheckoutService
{
static readonly string __ServiceName = "hipstershop.CheckoutService";
static readonly grpc::Marshaller<global::Hipstershop.CreateOrderRequest> __Marshaller_CreateOrderRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.CreateOrderRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.CreateOrderResponse> __Marshaller_CreateOrderResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.CreateOrderResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.PlaceOrderRequest> __Marshaller_PlaceOrderRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.PlaceOrderRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Hipstershop.PlaceOrderResponse> __Marshaller_PlaceOrderResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.PlaceOrderResponse.Parser.ParseFrom);
static readonly grpc::Method<global::Hipstershop.CreateOrderRequest, global::Hipstershop.CreateOrderResponse> __Method_CreateOrder = new grpc::Method<global::Hipstershop.CreateOrderRequest, global::Hipstershop.CreateOrderResponse>(
grpc::MethodType.Unary,
__ServiceName,
"CreateOrder",
__Marshaller_CreateOrderRequest,
__Marshaller_CreateOrderResponse);
static readonly grpc::Method<global::Hipstershop.PlaceOrderRequest, global::Hipstershop.PlaceOrderResponse> __Method_PlaceOrder = new grpc::Method<global::Hipstershop.PlaceOrderRequest, global::Hipstershop.PlaceOrderResponse>(
grpc::MethodType.Unary,
__ServiceName,
"PlaceOrder",
__Marshaller_PlaceOrderRequest,
__Marshaller_PlaceOrderResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Hipstershop.DemoReflection.Descriptor.Services[7]; }
}
/// <summary>Base class for server-side implementations of CheckoutService</summary>
public abstract partial class CheckoutServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.CreateOrderResponse> CreateOrder(global::Hipstershop.CreateOrderRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
public virtual global::System.Threading.Tasks.Task<global::Hipstershop.PlaceOrderResponse> PlaceOrder(global::Hipstershop.PlaceOrderRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for CheckoutService</summary>
public partial class CheckoutServiceClient : grpc::ClientBase<CheckoutServiceClient>
{
/// <summary>Creates a new client for CheckoutService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public CheckoutServiceClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for CheckoutService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public CheckoutServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected CheckoutServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected CheckoutServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::Hipstershop.CreateOrderResponse CreateOrder(global::Hipstershop.CreateOrderRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return CreateOrder(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.CreateOrderResponse CreateOrder(global::Hipstershop.CreateOrderRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_CreateOrder, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.CreateOrderResponse> CreateOrderAsync(global::Hipstershop.CreateOrderRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return CreateOrderAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.CreateOrderResponse> CreateOrderAsync(global::Hipstershop.CreateOrderRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_CreateOrder, null, options, request);
}
public virtual global::Hipstershop.PlaceOrderResponse PlaceOrder(global::Hipstershop.PlaceOrderRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return PlaceOrder(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Hipstershop.PlaceOrderResponse PlaceOrder(global::Hipstershop.PlaceOrderRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_PlaceOrder, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.PlaceOrderResponse> PlaceOrderAsync(global::Hipstershop.PlaceOrderRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return PlaceOrderAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Hipstershop.PlaceOrderResponse> PlaceOrderAsync(global::Hipstershop.PlaceOrderRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_PlaceOrder, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override CheckoutServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new CheckoutServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(CheckoutServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_CreateOrder, serviceImpl.CreateOrder)
.AddMethod(__Method_PlaceOrder, serviceImpl.PlaceOrder).Build();
}
}
}
#endregion

View file

@ -56,7 +56,14 @@ namespace cartservice
Console.WriteLine($"Trying to start a grpc server at {host}:{port}");
Server server = new Server
{
Services = { Hipstershop.CartService.BindService(new CartServiceImpl(cartStore)) },
Services =
{
// Cart Service Endpoint
Hipstershop.CartService.BindService(new CartServiceImpl(cartStore)),
// Health Endpoint
Grpc.Health.V1.Health.BindService(new HealthImpl(cartStore))
},
Ports = { new ServerPort(host, port, ServerCredentials.Insecure) }
};

View file

@ -7,9 +7,10 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.2.1" />
<PackageReference Include="Google.Protobuf" Version="3.5.1" />
<PackageReference Include="Google.Protobuf" Version="3.6.1" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.5.1" />
<PackageReference Include="grpc" Version="1.12.0" />
<PackageReference Include="Grpc.HealthCheck" Version="1.15.0" />
<PackageReference Include="grpc.tools" Version="1.12.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />

View file

@ -82,5 +82,10 @@ namespace cartservice.cartstore
return Task.FromResult(cart);
}
public bool Ping()
{
return true;
}
}
}

View file

@ -197,5 +197,18 @@ namespace cartservice.cartstore
throw new RpcException(new Status(StatusCode.FailedPrecondition, $"Can't access cart storage. {ex}"));
}
}
public bool Ping()
{
try
{
EnsureRedisConnected();
return true;
}
catch (Exception)
{
return false;
}
}
}
}

View file

@ -22,6 +22,6 @@ cd /d %~dp0
set NUGET_PATH=%UserProfile%\.nuget\packages
set TOOLS_PATH=%NUGET_PATH%\Grpc.Tools\1.12.0\tools\windows_x64
%TOOLS_PATH%\protoc.exe -I%~dp0/../../pb;%NUGET_PATH%\google.protobuf.tools\3.5.1\tools\ --csharp_out %~dp0 %~dp0\..\..\pb\demo.proto --grpc_out %~dp0 --plugin=protoc-gen-grpc=%TOOLS_PATH%\grpc_csharp_plugin.exe
%TOOLS_PATH%\protoc.exe -I%~dp0/../../pb;%NUGET_PATH%\google.protobuf.tools\3.5.1\tools\ --csharp_out %~dp0\grpc_generated %~dp0\..\..\pb\demo.proto --grpc_out %~dp0\grpc_generated --plugin=protoc-gen-grpc=%TOOLS_PATH%\grpc_csharp_plugin.exe
endlocal

View file

@ -1,323 +0,0 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: grpc/health/v1/health.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Grpc.Health.V1 {
/// <summary>Holder for reflection information generated from grpc/health/v1/health.proto</summary>
public static partial class HealthReflection {
#region Descriptor
/// <summary>File descriptor for grpc/health/v1/health.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static HealthReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChtncnBjL2hlYWx0aC92MS9oZWFsdGgucHJvdG8SDmdycGMuaGVhbHRoLnYx",
"IiUKEkhlYWx0aENoZWNrUmVxdWVzdBIPCgdzZXJ2aWNlGAEgASgJIpQBChNI",
"ZWFsdGhDaGVja1Jlc3BvbnNlEkEKBnN0YXR1cxgBIAEoDjIxLmdycGMuaGVh",
"bHRoLnYxLkhlYWx0aENoZWNrUmVzcG9uc2UuU2VydmluZ1N0YXR1cyI6Cg1T",
"ZXJ2aW5nU3RhdHVzEgsKB1VOS05PV04QABILCgdTRVJWSU5HEAESDwoLTk9U",
"X1NFUlZJTkcQAjJaCgZIZWFsdGgSUAoFQ2hlY2sSIi5ncnBjLmhlYWx0aC52",
"MS5IZWFsdGhDaGVja1JlcXVlc3QaIy5ncnBjLmhlYWx0aC52MS5IZWFsdGhD",
"aGVja1Jlc3BvbnNlQmEKEWlvLmdycGMuaGVhbHRoLnYxQgtIZWFsdGhQcm90",
"b1ABWixnb29nbGUuZ29sYW5nLm9yZy9ncnBjL2hlYWx0aC9ncnBjX2hlYWx0",
"aF92MaoCDkdycGMuSGVhbHRoLlYxYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Health.V1.HealthCheckRequest), global::Grpc.Health.V1.HealthCheckRequest.Parser, new[]{ "Service" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Health.V1.HealthCheckResponse), global::Grpc.Health.V1.HealthCheckResponse.Parser, new[]{ "Status" }, null, new[]{ typeof(global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus) }, null)
}));
}
#endregion
}
#region Messages
public sealed partial class HealthCheckRequest : pb::IMessage<HealthCheckRequest> {
private static readonly pb::MessageParser<HealthCheckRequest> _parser = new pb::MessageParser<HealthCheckRequest>(() => new HealthCheckRequest());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HealthCheckRequest> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Health.V1.HealthReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HealthCheckRequest() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HealthCheckRequest(HealthCheckRequest other) : this() {
service_ = other.service_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HealthCheckRequest Clone() {
return new HealthCheckRequest(this);
}
/// <summary>Field number for the "service" field.</summary>
public const int ServiceFieldNumber = 1;
private string service_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Service {
get { return service_; }
set {
service_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as HealthCheckRequest);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HealthCheckRequest other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Service != other.Service) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Service.Length != 0) hash ^= Service.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
if (Service.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Service);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (Service.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Service);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HealthCheckRequest other) {
if (other == null) {
return;
}
if (other.Service.Length != 0) {
Service = other.Service;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Service = input.ReadString();
break;
}
}
}
}
}
public sealed partial class HealthCheckResponse : pb::IMessage<HealthCheckResponse> {
private static readonly pb::MessageParser<HealthCheckResponse> _parser = new pb::MessageParser<HealthCheckResponse>(() => new HealthCheckResponse());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HealthCheckResponse> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Health.V1.HealthReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HealthCheckResponse() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HealthCheckResponse(HealthCheckResponse other) : this() {
status_ = other.status_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HealthCheckResponse Clone() {
return new HealthCheckResponse(this);
}
/// <summary>Field number for the "status" field.</summary>
public const int StatusFieldNumber = 1;
private global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus status_ = 0;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus Status {
get { return status_; }
set {
status_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as HealthCheckResponse);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HealthCheckResponse other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Status != other.Status) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Status != 0) hash ^= Status.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
if (Status != 0) {
output.WriteRawTag(8);
output.WriteEnum((int) Status);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (Status != 0) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Status);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HealthCheckResponse other) {
if (other == null) {
return;
}
if (other.Status != 0) {
Status = other.Status;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
status_ = (global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus) input.ReadEnum();
break;
}
}
}
}
#region Nested types
/// <summary>Container for nested types declared in the HealthCheckResponse message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
public enum ServingStatus {
[pbr::OriginalName("UNKNOWN")] Unknown = 0,
[pbr::OriginalName("SERVING")] Serving = 1,
[pbr::OriginalName("NOT_SERVING")] NotServing = 2,
}
}
#endregion
}
#endregion
}
#endregion Designer generated code

View file

@ -1,115 +0,0 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: grpc/health/v1/health.proto
// </auto-generated>
// Original file comments:
// Copyright 2015 The gRPC Authors
//
// 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.
//
// The canonical version of this proto can be found at
// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
//
#pragma warning disable 1591
#region Designer generated code
using grpc = global::Grpc.Core;
namespace Grpc.Health.V1 {
public static partial class Health
{
static readonly string __ServiceName = "grpc.health.v1.Health";
static readonly grpc::Marshaller<global::Grpc.Health.V1.HealthCheckRequest> __Marshaller_HealthCheckRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Health.V1.HealthCheckRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Grpc.Health.V1.HealthCheckResponse> __Marshaller_HealthCheckResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Health.V1.HealthCheckResponse.Parser.ParseFrom);
static readonly grpc::Method<global::Grpc.Health.V1.HealthCheckRequest, global::Grpc.Health.V1.HealthCheckResponse> __Method_Check = new grpc::Method<global::Grpc.Health.V1.HealthCheckRequest, global::Grpc.Health.V1.HealthCheckResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Check",
__Marshaller_HealthCheckRequest,
__Marshaller_HealthCheckResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Grpc.Health.V1.HealthReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of Health</summary>
public abstract partial class HealthBase
{
public virtual global::System.Threading.Tasks.Task<global::Grpc.Health.V1.HealthCheckResponse> Check(global::Grpc.Health.V1.HealthCheckRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for Health</summary>
public partial class HealthClient : grpc::ClientBase<HealthClient>
{
/// <summary>Creates a new client for Health</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public HealthClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for Health that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public HealthClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected HealthClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected HealthClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Check(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Check, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return CheckAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Check, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override HealthClient NewInstance(ClientBaseConfiguration configuration)
{
return new HealthClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(HealthBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_Check, serviceImpl.Check).Build();
}
}
}
#endregion

View file

@ -24,5 +24,7 @@ namespace cartservice.interfaces
Task EmptyCartAsync(string userId);
Task<Hipstershop.Cart> GetCartAsync(string userId);
bool Ping();
}
}