Beispiel #1
0
        static int Main(string[] args)
        {
            /*
             * --- main ---
             * Args: 1: Broker address (ip-addr:port)
             *       2: Queue name
             *       3: QPIDIT AMQP type name of expected message body values
             *       4: Expected number of test values to receive
             */
            int         exitCode = 0;
            const Int32 mbFactor = 1024 * 1024; // command line specifies small(ish) numbers of megabytes. Adjust size of a megabyte here.

            try
            {
                if (args.Length != 4)
                {
                    throw new ApplicationException(
                              "program requires four arguments: brokerAddr queueName amqpType nValues");
                }
                //Trace.TraceLevel = TraceLevel.Frame | TraceLevel.Verbose;
                //Trace.TraceListener = (f, a) => Console.WriteLine(DateTime.Now.ToString("[hh:mm:ss.fff]") + " " + string.Format(f, a));

                Receiver receiver = new Qpidit.Receiver(
                    args[0], args[1], args[2], Int32.Parse(args[3]), mbFactor);
                receiver.run();

                Console.WriteLine(args[2]);
                Console.WriteLine("{0}", receiver.ReceivedValueList);
            }
            catch (Exception e)
            {
                string firstline = new StringReader(e.ToString()).ReadLine();
                Console.Error.WriteLine("AmqpReceiver error: {0}.", firstline);
                exitCode = 1;
            }

            return(exitCode);
        }
Beispiel #2
0
        static int Main(string[] args)
        {
            /*
             * --- main ---
             * Args: 1: Broker address (ip-addr:port)
             *       2: Queue name
             *       3: QPIDIT AMQP type name of expected message body values
             *       4: Expected number of test values to receive
             */
            if (args.Length != 4)
            {
                throw new System.ArgumentException(
                          "Required argument count must be 4: brokerAddr queueName amqpType nValues");
            }
            int exitCode = 0;

            //Trace.TraceLevel = TraceLevel.Frame | TraceLevel.Verbose;
            //Trace.TraceListener = (f, a) => Console.WriteLine(DateTime.Now.ToString("[hh:mm:ss.fff]") + " " + string.Format(f, a));

            try
            {
                Receiver receiver = new Qpidit.Receiver(
                    args[0], args[1], args[2], Int32.Parse(args[3]));
                receiver.run();

                Console.WriteLine(args[2]);
                Console.WriteLine("{0}", receiver.ReceivedValueList);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("AmqpReceiver error: {0}.", e);
                exitCode = 1;
            }

            return(exitCode);
        }