Exemple #1
0
 public static IRpcBuilder UseConsulRouteManager(this IRpcBuilder builder,
                                                 ConsulRpcOptionsConfiguration consulRpcOptionsConfiguration)
 {
     return(builder.UseRouteManager(provider =>
                                    new ConsulServiceRouteManager(
                                        consulRpcOptionsConfiguration,
                                        provider.GetRequiredService <ISerializer <byte[]> >(),
                                        provider.GetRequiredService <ISerializer <string> >(),
                                        provider.GetRequiredService <IServiceRouteFactory>(),
                                        provider.GetRequiredService <ILogger <ConsulServiceRouteManager> >()
                                        )));
 }
        public ConsulServiceRouteManager(
            ConsulRpcOptionsConfiguration consulRpcOptionsConfiguration,
            ISerializer <byte[]> byteSerializer,
            ISerializer <string> stringSerializer,
            IServiceRouteFactory serviceRouteFactory,
            ILogger <ConsulServiceRouteManager> logger
            ) : base(stringSerializer)
        {
            _rpcOptionsConfiguration = consulRpcOptionsConfiguration;
            _configInfo          = consulRpcOptionsConfiguration.ConsulClientConfiguration;
            _byteSerializer      = byteSerializer;
            _serviceRouteFactory = serviceRouteFactory;
            _logger = logger;

            CreateConsul();
        }