public static void Main(string[] args) { INode node = NodeFactory.Default; node.Loger.Type = LogType.ALL; node.AddLogHandler(new SmartRoute.ConsoleLogHandler(LogType.ALL)); node.Open(); EventSubscriber henry = node.Register <EventSubscriber>("henry"); henry.Register <User>(OnUser); henry.Register <Employee>(OnEmployees); node.SubscriberRegisted = (n, s) => { if (s.Name == "ken") { // System.Threading.ThreadPool.QueueUserWorkItem(ToKen, henry); } }; while (true) { //System.Text.StringBuilder sb = new System.Text.StringBuilder(); //foreach (ISubscriber item in node.GetLocalSubscriber()) // sb.Append(item.ToString() + ','); //foreach (ISubscriber item in node.GetRemoteSubscriber()) // sb.Append(item.ToString() + ','); //node.Loger.Process(LogType.INFO, sb.ToString()); // Console.WriteLine(mCount); System.Threading.Thread.Sleep(1000); } Console.Read(); }
public static void Main(string[] args) { INode node = NodeFactory.Default; node.Loger.Type = LogType.ALL; node.AddLogHandler(new SmartRoute.ConsoleLogHandler(LogType.ALL)); node.Open(); EventSubscriber ken = node.Register <EventSubscriber>("ken"); ken.Register <User>(OnUser); ken.Register <Employee>(OnEmployees); node.SubscriberRegisted = (n, s) => { if (s.Name == "henry") { ken.Publish("henry", Employee.GetEmployee()); } }; while (true) { Console.WriteLine(mCount); System.Threading.Thread.Sleep(1000); } Console.Read(); }
public DMonitoCenter(INode node, int timeout = 10000) { TimeOut = timeout; mLockEventSubscriber = node.Register <EventSubscriber>(SMART_DLOCKCENTER); mLockEventSubscriber.Register <Protocols.EnterKey>(OnEnter); mLockEventSubscriber.Register <Protocols.FreeKey>(OnFree); Node = node; }
public DMonitoCenter(int timeout = 10000) { Node = SmartRoute.NodeFactory.Default; TimeOut = timeout; mLockEventSubscriber = Node.Register <EventSubscriber>(SMART_DLOCKCENTER); mLockEventSubscriber.Register <Protocols.EnterKey>(OnEnter); mLockEventSubscriber.Register <Protocols.FreeKey>(OnFree); }
public static void Main(string[] args) { INode node = NodeFactory.Default; node.Loger.Type = LogType.ALL; node.AddLogHandler(new SmartRoute.ConsoleLogHandler(LogType.ALL)); node.Open(); EventSubscriber henry = node.Register <EventSubscriber>("henry"); henry.Register <User>(OnUser); henry.Register <Employee>(OnEmployees); Console.Read(); }
public static void Main(string[] args) { INode node = NodeFactory.Default; node.Loger.Type = LogType.ALL; node.AddLogHandler(new SmartRoute.ConsoleLogHandler(LogType.ALL)); node.Open(); EventSubscriber henry = node.Register <EventSubscriber>("henry"); henry.Register <User>(OnUser); henry.Register <Employee>(OnEmployees); while (true) { Console.WriteLine("{0}/s|{1}", mCount - mLastCount, mCount); mLastCount = mCount; System.Threading.Thread.Sleep(1000); } Console.Read(); }
public void Start() { mEventSubscriber = Node.Register <EventSubscriber>(NBR_SERVER_TAG); mEventSubscriber.Register <Request>(OnRequest); }