예제 #1
0
        static int Main(string[] args)
        {
            /*
             * --- main ---
             * Args: 1: Broker address (ip-addr:port)
             *       2: Queue name
             *       3: AMQP type
             *       4: Test value(s) as JSON string
             */
            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 jsonValuesToSend");
                }
                //Trace.TraceLevel = TraceLevel.Frame | TraceLevel.Verbose;
                //Trace.TraceListener = (f, a) => Console.WriteLine(DateTime.Now.ToString("[hh:mm:ss.fff]") + " " + string.Format(f, a));

                Sender sender = new Qpidit.Sender(args[0], args[1], args[2], args[3], mbFactor);
                sender.run();
            }
            catch (Exception e)
            {
                string firstline = new StringReader(e.ToString()).ReadLine();
                Console.Error.WriteLine("AmqpSender error: {0}.", firstline);
                exitCode = 1;
            }

            return(exitCode);
        }
예제 #2
0
        static int Main(string[] args)
        {
            /*
             * --- main ---
             * Args: 1: Broker address (ip-addr:port)
             *       2: Queue name
             *       3: AMQP type
             *       4: Test value(s) as JSON string
             */
            if (args.Length != 4)
            {
                throw new System.ArgumentException(
                          "Required argument count must be 4: brokerAddr queueName amqpType jsonValuesToSend");
            }
            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
            {
                Sender sender = new Qpidit.Sender(args[0], args[1], args[2], args[3]);
                sender.run();
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("AmqpSender error: {0}.", e);
                exitCode = 1;
            }

            return(exitCode);
        }