/// <summary> /// Only intended for testing. /// </summary> /// <param name="servicePublisher"></param> /// <param name="serviceImplProvider"></param> /// <param name="definitionsProvider"></param> protected RpcServerHostBase( IRpcServicePublisher servicePublisher, IRpcServiceActivator serviceImplProvider, IRpcServiceDefinitionsProvider definitionsProvider, IRpcServerOptions?options, ILoggerFactory?loggerFactory = null) : base(servicePublisher, serviceImplProvider, definitionsProvider, options, loggerFactory) { }
public GrpcServer( IRpcServicePublisher servicePublisher, IRpcServiceActivator serviceImplProvider, IRpcServiceDefinitionsProvider serviceDefinitionsProvider, IServiceProvider?serviceProvider, RpcServerOptions?options = null) : base(servicePublisher, serviceImplProvider, serviceDefinitionsProvider, options) { this.ServiceProvider = serviceProvider; List <GrpcCore.ChannelOption> channelOptions = new List <GrpcCore.ChannelOption>(); var maxReceiveMessageSize = options?.ReceiveMaxMessageSize; if (maxReceiveMessageSize != null) { channelOptions.Add(new GrpcCore.ChannelOption(GrpcCore.ChannelOptions.MaxReceiveMessageLength, maxReceiveMessageSize.Value)); } var maxSendMessageSize = options?.SendMaxMessageSize; if (maxSendMessageSize != null) { channelOptions.Add(new GrpcCore.ChannelOption(GrpcCore.ChannelOptions.MaxSendMessageLength, maxSendMessageSize.Value)); } this.grpcServer = new GrpcCore.Server(channelOptions); }
protected RpcServerBase( IRpcServicePublisher servicePublisher, IRpcServiceActivator serviceActivator, IRpcServiceDefinitionsProvider definitionsProvider, IRpcServerOptions?options, ILoggerFactory?loggerFactory) { this.ServicePublisher = servicePublisher ?? throw new ArgumentNullException(nameof(servicePublisher)); this.ServiceActivator = serviceActivator ?? throw new ArgumentNullException(nameof(serviceActivator)); this.ServiceDefinitionsProvider = definitionsProvider ?? throw new ArgumentNullException(nameof(definitionsProvider)); this.LoggerFactory = loggerFactory; this.Logger = loggerFactory?.CreateLogger(this.GetType()) ?? RpcLogger.CreateLogger(this.GetType()); if (options != null) { this.serializer = options.Serializer; this.AllowDiscovery = options.AllowDiscovery ?? true; this.AllowAutoPublish = options.AllowAutoPublish ?? false; this.CallInterceptors = options.Interceptors.ToImmutableArrayList(); this.ExceptionConverters = options.ExceptionConverters.ToImmutableArrayList(); } if (this.ExceptionConverters.Count > 0) { this.CustomFaultHandler = new RpcServerFaultHandler(null, this.ExceptionConverters, null); } else { this.CustomFaultHandler = RpcServerFaultHandler.Default; } }
internal NetGrpcServer( IRpcServicePublisher servicePublisher, IRpcServiceActivator serviceImplProvider, IRpcServiceDefinitionsProvider serviceDefinitionsProvider, //ServiceMethodProviderContext<NetGrpcServiceActivator>? context, RpcServerOptions?options, ILoggerFactory?loggerFactory) : base(servicePublisher, serviceImplProvider, serviceDefinitionsProvider, options, loggerFactory) { }
/// <summary> /// Internal to allow testing. /// </summary> internal LightweightRpcServer( IRpcServicePublisher servicePublisher, IRpcServiceActivator serviceImplProvider, IRpcServiceDefinitionsProvider definitionsProvider, IServiceProvider?serviceProvider, IRpcServerOptions?options, LightweightOptions?lightweightOptions = null, ILoggerFactory?loggerFactory = null) : base(servicePublisher, serviceImplProvider, definitionsProvider, options, loggerFactory) { this.ServiceProvider = serviceProvider; this.MaxRequestSize = options?.ReceiveMaxMessageSize ?? DefaultMaxRequestMessageSize; this.MaxResponseSize = options?.SendMaxMessageSize ?? DefaultMaxResponseMessageSize; this.KeepSizeLimitedConnectionAlive = lightweightOptions?.KeepSizeLimitedConnectionAlive ?? true; }