Beispiel #1
0
        static void Main(string[] args)
        {
            Console.Title = "RpcServer";
            var server = new RpcServer();

            server.Start();
            Console.WriteLine("服务器启动成功");
            Console.ReadLine();
            server.Close();
        }
Beispiel #2
0
        /// <summary>
        /// 关闭
        /// </summary>
        public void Close()
        {
            RpcServer.Close();

            if (isSingleConnCreated)
            {
                SingleConnectionTool.Connection.Close();
            }

            OnClosed();
        }
Beispiel #3
0
        private static void StartRpcServer(CliArgs args)
        {
            // Create a factory used to instantiate all the service implementations
            // that are needed to initialize the server.
            Factory factory = new Factory("config/application.conf");

            // Build a gRPC server instance.
            ServerBuilder serverBuilder = ServerBuilder
                                          .ForPort(args.port)
                                          .ReportErrorDetails()
                                          .WithAccountService(factory.AccountService())
                                          .WithAccountLinkingService(factory.AccountLinkingService())
                                          .WithTransferService(factory.TransferService())
                                          .WithStorageService(factory.StorageService())
                                          .WithAccountManagementService(factory.AccountManagementService())
                                          .WithConsentManagementService(factory.ConsentManagementService())
                                          .WithNotificationService(factory.NotificationService());

            if (args.useSsl)
            {
                serverBuilder.WithTls(
                    "config/tls/cert.pem",
                    "config/tls/key.pem",
                    "config/tls/trusted-certs.pem");
            }

            RpcServer server = serverBuilder.Build();

            // You will need to Ctrl-C to exit.
            server.Start();
            logger.Info("Hit return to stop the server ");
            Console.ReadKey();
            logger.Info("Stopping the server....");
            server.Close();
            logger.Info("Server stopped");
        }
Beispiel #4
0
 public Task StopAsync(CancellationToken cancellationToken)
 {
     _rpcServer.Close();
     _logger.LogInformation("RpcServer-Rabbitmq 停止");
     return(Task.CompletedTask);
 }
 public void Close()
 {
     rpcServer.Close();
 }