예제 #1
0
 public Task StartAsync(CancellationToken cancellationToken)
 {
     return(Task.Factory.StartNew(() =>
     {
         GrpcServiceManager.Start(GrpcExampleService.BindService(_grpcServiceBase), _tracer);
     }, cancellationToken));
 }
예제 #2
0
        public void Start(string serviceName)
        {
            // LogHelper.LogInfo($"{serviceName}服务启动");
            // autofac
            var container = AutofacContainer.Register();

            // grpc
            GrpcServiceManager.Start(GrpcExampleService.BindService(new GrpcExampleServiceImpl(container)), new ConsoleTracer(), whenException: (ex) =>
            {
            });
        }
 public Task StartAsync(CancellationToken cancellationToken)
 {
     return(Task.Factory.StartNew(() =>
     {
         GrpcServiceManager.Start(GrpcExampleService.BindService(_grpcServiceBase), (grpcOptions) =>
         {
             grpcOptions.Tracer = _tracer;
             grpcOptions.GenServiceId = null;
         });
     }, cancellationToken));
 }
예제 #4
0
 public Task StartAsync(CancellationToken cancellationToken)
 {
     return(Task.Factory.StartNew(() =>
     {
         var channelOptions = new List <ChannelOption>()
         {
             new ChannelOption(ChannelOptions.MaxReceiveMessageLength, int.MaxValue),
             new ChannelOption(ChannelOptions.MaxSendMessageLength, int.MaxValue),
         };
         GrpcServiceManager.Start(BindService(_grpcServImpl), channelOptions: channelOptions, whenException: (ex) =>
         {
             _logger.LogError(ex, $"{typeof(HostedService).Namespace.Replace(".", "")}开启失败");
             throw ex;
         });
         System.Console.WriteLine("服务已经启动");
         _logger.LogInformation($"{nameof(Jlion.NetCore.OrderService.Service).Replace(".", "")}开启成功");
     }, cancellationToken));
 }
예제 #5
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            return(Task.Factory.StartNew(() =>
            {
                var channelOptions = new List <ChannelOption>()
                {
                    new ChannelOption(ChannelOptions.MaxReceiveMessageLength, int.MaxValue),
                    new ChannelOption(ChannelOptions.MaxSendMessageLength, int.MaxValue),
                };
                GrpcServiceManager.Start(BindService(_grpcServImpl), channelOptions: channelOptions, whenException: (ex) =>
                {
                    _logger.LogError($"{nameof(Overt.GrpcTemplate.Service).Replace(".", "")}服务器开启失败");
                    throw ex;
                });

                _logger.LogError($"{nameof(Overt.GrpcTemplate.Service).Replace(".", "")}开启");
            }, cancellationToken));
        }