예제 #1
0
        static void Main(string[] mainArgs)
        {
            Options opts = new Options();

            opts.Parse(mainArgs);
            QueueChannelFactory.SetBroker(opts.broker, opts.port);
            QueueChannelFactory.SetSecurity(opts.ssl, opts.username, opts.password);

            WarmUpTransactionSubsystem(opts);

            if (opts.type == ClientType.Publisher)
            {
                PublishThread pub       = new PublishThread(opts.baseName + "0", "", opts);
                Thread        pubThread = new Thread(pub.Run);
                pubThread.Start();
                pubThread.Join();
            }
            else if (opts.type == ClientType.Subscriber)
            {
                SubscribeThread sub       = new SubscribeThread(opts.baseName + "0", opts);
                Thread          subThread = new Thread(sub.Run);
                subThread.Start();
                subThread.Join();
            }
            else
            {
                InteropDemo(opts);
            }

            if (System.Diagnostics.Debugger.IsAttached)
            {
                Console.WriteLine("Hit return to continue...");
                Console.ReadLine();
            }
        }
예제 #2
0
파일: WcfPerftest.cs 프로젝트: ncdc/qpid
        static void Main(string[] mainArgs)
        {
            Options opts = new Options();
            opts.Parse(mainArgs);
            QueueChannelFactory.SetBroker(opts.broker, opts.port);
            QueueChannelFactory.SetSecurity(opts.ssl, opts.username, opts.password);

            WarmUpTransactionSubsystem(opts);

            if (opts.type == ClientType.Publisher)
            {
                PublishThread pub = new PublishThread(opts.baseName + "0", "", opts);
                Thread pubThread = new Thread(pub.Run);
                pubThread.Start();
                pubThread.Join();
            }
            else if (opts.type == ClientType.Subscriber)
            {
                SubscribeThread sub = new SubscribeThread(opts.baseName + "0", opts);
                Thread subThread = new Thread(sub.Run);
                subThread.Start();
                subThread.Join();
            }
            else
            {
                InteropDemo(opts);
            }

            if (System.Diagnostics.Debugger.IsAttached)
            {
                Console.WriteLine("Hit return to continue...");
                Console.ReadLine();
            }
        }
예제 #3
0
        // demonstrate message exchange between WcfPerftest.exe and native
        // C++ perftest.exe

        static void InteropDemo(Options opts)
        {
            string perftest_cpp_exe = "qpid-perftest.exe";
            string commonArgs       = String.Format(" --count {0} --size {1} --broker {2} --port {3}", opts.messageCount, opts.messageSize, opts.broker, opts.port);

            if (opts.durable)
            {
                commonArgs += " --durable yes";
            }

            if (opts.ssl)
            {
                commonArgs += " --protocol ssl";
            }

            if (opts.saslMechanism == SaslMechanism.Plain)
            {
                commonArgs += String.Format(" --username {0} --password {1} --mechanism PLAIN", opts.username, opts.password);
            }

            Console.WriteLine("===== WCF Subscriber and C++ Publisher =====");

            Process setup = new Process();

            setup.StartInfo.FileName        = perftest_cpp_exe;
            setup.StartInfo.UseShellExecute = false;
            setup.StartInfo.Arguments       = "--setup" + commonArgs;
            try
            {
                setup.Start();
            }
            catch (Win32Exception win32e)
            {
                Console.WriteLine("Cannot execute {0}: PATH not set?", perftest_cpp_exe);
                Console.WriteLine("   Error: {0}", win32e.Message);
                return;
            }
            setup.WaitForExit();

            Process control = new Process();

            control.StartInfo.FileName        = perftest_cpp_exe;
            control.StartInfo.UseShellExecute = false;
            control.StartInfo.Arguments       = "--control" + commonArgs;
            control.Start();

            Process publish = new Process();

            publish.StartInfo.FileName        = perftest_cpp_exe;
            publish.StartInfo.UseShellExecute = false;
            publish.StartInfo.Arguments       = "--publish" + commonArgs;
            publish.Start();

            SubscribeThread subscribeWcf = new SubscribeThread(opts.baseName + "0", opts);
            Thread          subThread    = new Thread(subscribeWcf.Run);

            subThread.Start();

            subThread.Join();
            publish.WaitForExit();
            control.WaitForExit();

            Console.WriteLine();
            Console.WriteLine("=====  WCF Publisher and C++ Subscriber =====");

            setup = new Process();
            setup.StartInfo.FileName        = perftest_cpp_exe;
            setup.StartInfo.UseShellExecute = false;
            setup.StartInfo.Arguments       = "--setup" + commonArgs;
            setup.Start();
            setup.WaitForExit();

            control = new Process();
            control.StartInfo.FileName        = perftest_cpp_exe;
            control.StartInfo.UseShellExecute = false;
            control.StartInfo.Arguments       = "--control" + commonArgs;
            control.Start();

            PublishThread pub       = new PublishThread(opts.baseName + "0", "", opts);
            Thread        pubThread = new Thread(pub.Run);

            pubThread.Start();

            Process subscribeCpp = new Process();

            subscribeCpp.StartInfo.FileName        = perftest_cpp_exe;
            subscribeCpp.StartInfo.UseShellExecute = false;
            subscribeCpp.StartInfo.Arguments       = "--subscribe" + commonArgs;
            subscribeCpp.Start();

            subscribeCpp.WaitForExit();
            pubThread.Join();
            control.WaitForExit();
        }
예제 #4
0
파일: WcfPerftest.cs 프로젝트: ncdc/qpid
        // demonstrate message exchange between WcfPerftest.exe and native
        // C++ perftest.exe
        static void InteropDemo(Options opts)
        {
            string perftest_cpp_exe = "qpid-perftest.exe";
            string commonArgs = String.Format(" --count {0} --size {1} --broker {2} --port {3}", opts.messageCount, opts.messageSize, opts.broker, opts.port);

            if (opts.durable)
            {
                commonArgs += " --durable yes";
            }

            if (opts.ssl)
            {
                commonArgs += " --protocol ssl";
            }

            if (opts.saslMechanism == SaslMechanism.Plain)
            {
                commonArgs += String.Format(" --username {0} --password {1} --mechanism PLAIN", opts.username, opts.password);
            }

            Console.WriteLine("===== WCF Subscriber and C++ Publisher =====");

            Process setup = new Process();
            setup.StartInfo.FileName = perftest_cpp_exe;
            setup.StartInfo.UseShellExecute = false;
            setup.StartInfo.Arguments = "--setup" + commonArgs;
            try
            {
                setup.Start();
            }
            catch (Win32Exception win32e)
            {
                Console.WriteLine("Cannot execute {0}: PATH not set?", perftest_cpp_exe);
                Console.WriteLine("   Error: {0}", win32e.Message);
                return;
            }
            setup.WaitForExit();

            Process control = new Process();
            control.StartInfo.FileName = perftest_cpp_exe;
            control.StartInfo.UseShellExecute = false;
            control.StartInfo.Arguments = "--control" + commonArgs;
            control.Start();

            Process publish = new Process();
            publish.StartInfo.FileName = perftest_cpp_exe;
            publish.StartInfo.UseShellExecute = false;
            publish.StartInfo.Arguments = "--publish" + commonArgs;
            publish.Start();

            SubscribeThread subscribeWcf = new SubscribeThread(opts.baseName + "0", opts);
            Thread subThread = new Thread(subscribeWcf.Run);
            subThread.Start();

            subThread.Join();
            publish.WaitForExit();
            control.WaitForExit();

            Console.WriteLine();
            Console.WriteLine("=====  WCF Publisher and C++ Subscriber =====");

            setup = new Process();
            setup.StartInfo.FileName = perftest_cpp_exe;
            setup.StartInfo.UseShellExecute = false;
            setup.StartInfo.Arguments = "--setup" + commonArgs;
            setup.Start();
            setup.WaitForExit();

            control = new Process();
            control.StartInfo.FileName = perftest_cpp_exe;
            control.StartInfo.UseShellExecute = false;
            control.StartInfo.Arguments = "--control" + commonArgs;
            control.Start();

            PublishThread pub = new PublishThread(opts.baseName + "0", "", opts);
            Thread pubThread = new Thread(pub.Run);
            pubThread.Start();

            Process subscribeCpp = new Process();
            subscribeCpp.StartInfo.FileName = perftest_cpp_exe;
            subscribeCpp.StartInfo.UseShellExecute = false;
            subscribeCpp.StartInfo.Arguments = "--subscribe" + commonArgs;
            subscribeCpp.Start();

            subscribeCpp.WaitForExit();
            pubThread.Join();
            control.WaitForExit();
        }