static void Main(string[] args) { var builder = new ConfigurationBuilder(); builder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false); var configuration = builder.Build(); var gateways = configuration.GetSection("GatewayAddress").Get <NetAddress[]>(); ServiceCollection services = new ServiceCollection(); services.AddSingleton <IConfiguration>(configuration); services.AddLogging(loggingBuilder => { loggingBuilder.AddConfiguration(configuration.GetSection("Logging")); loggingBuilder.AddConsole(); // 将日志输出到控制台 }); var msp = new MicroServiceHost(services); //注册支持的服务类型 msp.Register <UserInfoController>("UserInfo"); msp.Build(7901, gateways) .Run(); }
public FaildCommitBuilder(MicroServiceHost microServiceHost, RetryCommitMission retryCommitMission, ILogger <TransactionDelegate> loggerTran) { this._retryCommitMission = retryCommitMission; this._loggerTran = loggerTran; this._microServiceHost = microServiceHost; }
public InvokeRequestHandler(TransactionDelegateCenter transactionDelegateCenter, ILogger <InvokeRequestHandler> logger, MicroServiceHost microServiceProvider) { _transactionDelegateCenter = transactionDelegateCenter; _MicroServiceProvider = microServiceProvider; _logger = logger; }
public void Test() { MicroServiceHost host = new MicroServiceHost(new ServiceCollection()); host.Register <TestController>("testService"); var type = typeof(MicroServiceHost).Assembly.GetType("JMS.GenerateCode.CodeBuilder"); var builder = Activator.CreateInstance(type, new object[] { host }); var str = type.GetMethod("GenerateCode").Invoke(builder, new object[] { "abc", "MyClass", "testService" }); }
public GatewayConnector(MicroServiceHost microServiceHost, ICpuInfo cpuInfo, SSLConfiguration sSLConfiguration, ILogger <GatewayConnector> logger, IKeyLocker keyLocker) { _microServiceHost = microServiceHost; _logger = logger; _keyLocker = keyLocker; _cpuInfo = cpuInfo; _SSLConfiguration = sSLConfiguration; }
public InvokeRequestHandler(TransactionDelegateCenter transactionDelegateCenter, ILogger <InvokeRequestHandler> logger, ILogger <TransactionDelegate> loggerTran, MicroServiceHost microServiceProvider, FaildCommitBuilder faildCommitBuilder) { this._faildCommitBuilder = faildCommitBuilder; _transactionDelegateCenter = transactionDelegateCenter; _MicroServiceProvider = microServiceProvider; _logger = logger; _loggerTran = loggerTran; }
public static void Main(string[] args) { /** * TODO: Running on default hosting address here, need to make sure * where we would want to host DataCat. Having a setting would be * definitely nice here. * */ var host = MicroServiceHost.CreateHost <Startup>("DataCat", "http://*:5000", args); host.Run(); }
public RequestReception(ILogger <RequestReception> logger, ProcessExitHandler processExitHandler, MicroServiceHost microServiceProvider) { _logger = logger; _MicroServiceProvider = microServiceProvider; _processExitHandler = processExitHandler; _SSLConfiguration = _MicroServiceProvider.ServiceProvider.GetService <SSLConfiguration>(); var handlerTypes = typeof(RequestReception).Assembly.DefinedTypes.Where(m => m.ImplementedInterfaces.Contains(typeof(IRequestHandler))); foreach (var type in handlerTypes) { var handler = (IRequestHandler)microServiceProvider.ServiceProvider.GetService(type); _cache[handler.MatchType] = handler; } }
public static void Main(string[] args) { MicroServiceHost.Start(args); }
public RetryCommitMission(MicroServiceHost microServiceHost, ILogger <TransactionDelegate> loggerTran) { this._microServiceHost = microServiceHost; this._loggerTran = loggerTran; }
public CodeBuilder(MicroServiceHost microServiceProvider) { _microServiceProvider = microServiceProvider; }
public MapFileManager(MicroServiceHost microServiceHost) { _microServiceHost = microServiceHost; }
public KeyLocker(MicroServiceHost microServiceHost) { _microServiceHost = microServiceHost; this.LockedKeyDict = new ConcurrentDictionary <string, string>(); RemovingKeyDict = new ConcurrentDictionary <string, string>(); }
public static IMicroServiceHost BuildMicroServiceHost(string[] args) => MicroServiceHost.CreateDefaultBuilder(args) .UseStartup <MicroServiceStartup>() .Build();