/// <summary>Creates service definition that can be registered with a server</summary> public static ServerServiceDefinition BindService(RpcServiceBase serviceImpl) { return(ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_SayHello, serviceImpl.SayHello) .AddMethod(__Method_SayHelloAgain, serviceImpl.SayHelloAgain) .AddMethod(__Method_MySum, serviceImpl.MySum) .AddMethod(__Method_TestConnection, serviceImpl.TestConnection) .AddMethod(__Method_ReceiveGroupTags, serviceImpl.ReceiveGroupTags).Build()); }
public void RegisterService(RpcServiceBase service) { if (_started) { throw new NotSupportedException("you can't register service after start"); } lock (_syncRoot) { _services.Add(service.ServiceName, service); } }
/// <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(RpcServiceBase serviceImpl) { return(grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_GetTimestamp, serviceImpl.GetTimestamp) .AddMethod(__Method_GetCounterJsonStr, serviceImpl.GetCounterJsonStr) .AddMethod(__Method_GetState, serviceImpl.GetState) .AddMethod(__Method_GetStateStr, serviceImpl.GetStateStr) .AddMethod(__Method_LoadJobConfig, serviceImpl.LoadJobConfig) .AddMethod(__Method_CreateWorker, serviceImpl.CreateWorker) .AddMethod(__Method_CollectCounters, serviceImpl.CollectCounters) .AddMethod(__Method_RunJob, serviceImpl.RunJob) .AddMethod(__Method_Test, serviceImpl.Test) .AddMethod(__Method_LoadConnectionConfig, serviceImpl.LoadConnectionConfig) .AddMethod(__Method_LoadConnectionRange, serviceImpl.LoadConnectionRange) .AddMethod(__Method_GetConnectionIds, serviceImpl.GetConnectionIds).Build()); }
/// <summary> /// 注册回调Service /// </summary> /// <param name="service"></param> public void RegisterRawService(RpcServiceBase service) { _dispatcher.RegisterService(service); }
/// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary> /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param> /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> public static void BindService(grpc::ServiceBinderBase serviceBinder, RpcServiceBase serviceImpl) { serviceBinder.AddMethod(__Method_RpcServiceExample, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Yyb.RpcServiceExampleRequest, global::Yyb.RpcServiceExampleReply>(serviceImpl.RpcServiceExample)); serviceBinder.AddMethod(__Method_Login, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Yyb.LoginRequest, global::Yyb.LoginReply>(serviceImpl.Login)); }
/// <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(RpcServiceBase serviceImpl) { return(grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_RpcServiceExample, serviceImpl.RpcServiceExample) .AddMethod(__Method_Login, serviceImpl.Login).Build()); }