static void Main(string[] args) { NLogLogger.Use(); ILog log = Logger.Get <Program>(); var localActor = new RpcActor(); var helloService = RpcServiceGenerator.CreateService <IHelloService>(localActor, new HelloService()); var calcService = RpcServiceGenerator.CreateService <ICalcService>(localActor, new CalcService()); var orderService = RpcServiceGenerator.CreateService <IOrderService>(localActor, new OrderService()); localActor.RegisterRpcService(helloService as RpcService); localActor.RegisterRpcService(calcService as RpcService); localActor.RegisterRpcService(orderService as RpcService); localActor.Bootup(); while (true) { try { string text = Console.ReadLine().ToLowerInvariant(); if (text == "quit" || text == "exit") { break; } else if (text == "reconnect") { localActor.Shutdown(); localActor.Bootup(); } else { log.WarnFormat("Cannot parse the operation for input [{0}].", text); } } catch (Exception ex) { log.Error(ex.Message, ex); } } localActor.Shutdown(); }
public static void Register <TService>(this RpcActor localActor, TService service) { var localService = RpcServiceGenerator.CreateService <TService>(localActor, service); localActor.RegisterRpcService(localService as RpcService); }