コード例 #1
0
        internal static GrpcServer StartGrpcServer(int port, bool isRetryEnabled)
        {
            // max 3 times attemps, including the original request.
            RetryPolicy retryPolicy = isRetryEnabled ?
                                      new RetryPolicy(3, (float)0.1, 5, 2) :
                                      null;

            GrpcServerLegacyQueryHandlerBase mockLegacyQueryHandler = new RetryableLegacyQueryHandler();
            //GrpcServerLegacyQueryHandlerBase mockLegacyQueryHandler =
            //                                    isRetryEnabled ?
            //                                        (GrpcServerLegacyQueryHandlerBase)new MockRetryableLegacyQueryHandler() :
            //                                        (GrpcServerLegacyQueryHandlerBase)new MockLegacyQueryHandler();
            LegacyQueryService legacyQueryService = GrpcServer.CreateLegacyQueryService(mockLegacyQueryHandler);

            GrpcServer grpcServer = new GrpcServer(
                port, legacyQueryService, retryPolicy: retryPolicy);

            grpcServer.Start();

            return(grpcServer);
        }