Beispiel #1
0
        void runPub(string testName, long testCount, long testSize)
        {
            byte[] payload = generatePayload(testSize);

            var opts = ConnectionFactory.GetDefaultOptions();

            opts.Url = url;
            if (creds != null)
            {
                opts.SetUserCredentials(creds);
            }

            using (IConnection c = new ConnectionFactory().CreateConnection(opts))
            {
                Stopwatch sw = sw = Stopwatch.StartNew();

                for (int i = 0; i < testCount; i++)
                {
                    c.Publish(subject, payload);
                }

                sw.Stop();

                PrintResults(testName, sw, testCount, testSize);
            }
        }
Beispiel #2
0
        void runPub(string testName, long testCount, long testSize)
        {
            byte[] payload = generatePayload(testSize);

            using (IConnection c = new ConnectionFactory().CreateConnection(url))
            {
                Stopwatch sw = sw = Stopwatch.StartNew();

                for (int i = 0; i < testCount; i++)
                {
                    c.Publish(subject, payload);
                }

                sw.Stop();

                PrintResults(testName, sw, testCount, testSize);
            }
        }