コード例 #1
0
ファイル: localPM.cs プロジェクト: canoxa/PubSubRedudant
        static void Main(string[] args)
        {
            Console.WriteLine("@localPM !!! porto -> {0}", args[0]);

            TcpChannel channel = new TcpChannel(Int32.Parse(args[0]));
            ChannelServices.RegisterChannel(channel, true);

            PMcreateProcess createProcess = new PMcreateProcess(Int32.Parse(args[0]));
            RemotingServices.Marshal(createProcess, "PuppetMasterURL", typeof(PMcreateProcess));

            Console.ReadLine();
        }
コード例 #2
0
ファイル: PuppetMaster.cs プロジェクト: canoxa/PubSub_v3.1
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());

            TcpChannel channel = new TcpChannel(Int32.Parse(args[0]));
            ChannelServices.RegisterChannel(channel, true);

            PMcreateProcess createProcess = new PMcreateProcess(Int32.Parse(args[0]));
            RemotingServices.Marshal(createProcess, "PuppetMasterURL", typeof(PMcreateProcess));

            /*
            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof(PMcreateProcess),
                "PuppetMasterURL",
                WellKnownObjectMode.Singleton);*/


            //lancar slaves
            for (int i = 0; i < 2; i++) {

                ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\DAD\PubSub_v3.1\localPM\bin\Debug\localPM.exe");
                int port = 9000 + (i*100);
                string arg = port.ToString();
                startInfo.Arguments = arg;

                Process p = new Process();
                p.StartInfo = startInfo;
                
                p.Start();
               
            }

            Scanner scan = new Scanner();
            
            TreeNode root = scan.getRootNodeFromFile(conf_filename);

            //criar arvore a partir de root
            scan.readTreeFromFile(root, conf_filename);
            

            //preencher lstProcess - lista de todos os processos no config file
            List<MyProcess> lstProcess = scan.fillProcessList(conf_filename, root);
            

            //estruturas para optimizar a procura
            Dictionary<string, string> pname_site = scan.getPname_site();
            Dictionary<string, TreeNode> site_treeNode = scan.getSite_Node();
            Dictionary<TreeNode, Broker> node_broker = scan.getNode_Broker();

            MessageBox.Show("finito");
        }
コード例 #3
0
ファイル: PuppetMaster.cs プロジェクト: canoxa/PubSubv4-Form
        //private static string proj_path = Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName).FullName;
        //private static string conf_filename = proj_path+@"\example.txt";
        static void Main(string[] args)
        {
            TcpChannel channel = new TcpChannel(Int32.Parse(args[0]));
            ChannelServices.RegisterChannel(channel, true);

            PMcreateProcess createProcess = new PMcreateProcess(Int32.Parse(args[0]));
            RemotingServices.Marshal(createProcess, "PuppetMasterURL", typeof(PMcreateProcess));

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());

            /*
            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof(PMcreateProcess),
                "PuppetMasterURL",
                WellKnownObjectMode.Singleton);*/

            //lancar slaves
            //for (int i = 0; i < 6; i++) {

            //    ProcessStartInfo startInfo = new ProcessStartInfo(proj_path+@"\localPM\bin\Debug\localPM.exe");
            //    int port = 9000 + (i*100);
            //    string arg = port.ToString();
            //    startInfo.Arguments = arg;

            //    Process p = new Process();
            //    p.StartInfo = startInfo;

            //    p.Start();

            //}

            //Scanner scan = new Scanner();

            //TreeNode root = scan.getRootNodeFromFile(conf_filename);

            ////criar arvore a partir de root
            //scan.readTreeFromFile(root, conf_filename);

            //scan.quickRead(conf_filename, root);

            //int routingMode = scan.getRouting();//0-flood; 1-filter
            //int orderMode = scan.getOrder();//0-NO; 1-FIFO; 2-TOTAL
            //int logMode = scan.getLogMode();//0-light; 1-full

            //////lancar servico de LOG
            //PMLog log = new PMLog(logMode);
            //RemotingServices.Marshal(log, "PuppetMasterLog", typeof(PMLog));

            ////preencher lstProcess - lista de todos os processos no config file
            //List<MyProcess> lstProcess = scan.fillProcessList(conf_filename, root);

            ////estrutura que diz em que porta está cada processo
            //Dictionary<string, int> pname_port = scan.getPname_port();

            //SubInterface subint = (SubInterface)Activator.GetObject(typeof(SubInterface),"tcp://localhost:"+pname_port["subscriber0"]+"/MPMSubUnsub");
            //subint.subscribe("grandeTopico");

            //subint = (SubInterface)Activator.GetObject(typeof(SubInterface), "tcp://localhost:" + pname_port["subscriber1"] + "/MPMSubUnsub");
            //subint.subscribe("grandeTopico");
            ////subint.subscribe("pequenoTopico");
            ////subint.unsubscribe("grandeTopico");

            //subint = (SubInterface)Activator.GetObject(typeof(SubInterface), "tcp://localhost:" + pname_port["subscriber2"] + "/MPMSubUnsub");
            //subint.subscribe("grandeTopico");
            ////subint.subscribe("pequenoTopico");

            //subint = (SubInterface)Activator.GetObject(typeof(SubInterface), "tcp://localhost:" + pname_port["subscriber3"] + "/MPMSubUnsub");
            ////subint.subscribe("grandeTopico");
            //subint.subscribe("pequenoTopico");

            //subint = (SubInterface)Activator.GetObject(typeof(SubInterface), "tcp://localhost:" + pname_port["subscriber4"] + "/MPMSubUnsub");
            //subint.subscribe("grandeTopico");
            ////subint.subscribe("pequenoTopico");

            //subint = (SubInterface)Activator.GetObject(typeof(SubInterface), "tcp://localhost:" + pname_port["subscriber5"] + "/MPMSubUnsub");
            //subint.subscribe("grandeTopico");
            ////subint.subscribe("pequenoTopico");

            //PubInterface pubint = (PubInterface)Activator.GetObject(typeof(PubInterface), "tcp://localhost:" + pname_port["publisher4"] + "/PMPublish");
            //pubint.publish("1", "pequenoTopico", "10",routingMode,orderMode);

            //MessageBox.Show("finito");
        }
コード例 #4
0
ファイル: PuppetMaster.cs プロジェクト: canoxa/PubSubRedudant
        //private static string proj_path = Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName).FullName;
        //private static string conf_filename = proj_path+@"\example.txt";
        static void Main(string[] args)
        {
            TcpChannel channel = new TcpChannel(Int32.Parse(args[0]));
            ChannelServices.RegisterChannel(channel, true);

            PMcreateProcess createProcess = new PMcreateProcess(Int32.Parse(args[0]));
            RemotingServices.Marshal(createProcess, "PuppetMasterURL", typeof(PMcreateProcess));

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }