/// <summary> /// RabitManager constructor. Creates the manager's thread. /// If the user has derived their own Workspace from the RabitWorkspace, /// it must be provided when the manager is constructed... otherwise /// the standard RabitWorkspace will be used. /// </summary> public RabitManager() { //Generate the Manager Name for use in tracking error messages. //and setting up queue names. managerName = this.GetType().ToString(); int idx = managerName.LastIndexOf('.'); managerName = managerName.Substring(idx + 1); managerThread = new Thread(new ThreadStart(managerMain)); managerThread.Name = managerName; shutdownManager = false; MgrStatus = new ManagerStatusMessage(); //Add all publish subscribe messages this manager relies on to the //global workspace here string mgrStatusMsgName = string.Concat(ManagerName, "Status"); AddPublishSubscribeMessage(mgrStatusMsgName, MgrStatus); MgrControl = new ManagerControlMessage(); AddPublishSubscribeMessage("ManagerControl", MgrControl); //string mgrMsgQueueName = string.Concat(ManagerName, "MessageQueue"); MgrMessageQueue = new RabitMessageQueue(100, ManagerName); //Add the Message Queue to the Global Workspace AddManagerMessageQueue(ManagerName, MgrMessageQueue); //Setup Event Handling ewhWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset); wakeupManagerEvent = new PublishSubscribeMessChangedHandler(wakeUpManagerEH); }
public override void CopyMessage(RabitMessage msg) { //Ensure that all base parameters/variables are copied. base.CopyMessage(msg); //Cast Message into the Concrete Message. ManagerStatusMessage cmsg = (ManagerStatusMessage)msg; ManagerStatus = cmsg.ManagerStatus; }