Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.CancelKeyPress += (sender, eventArgs) =>
            {
                eventArgs.Cancel = true;
                tokenSource.Cancel();
            };

            ParserResult <Options> parseResults = Parser.Default.ParseArguments <Options>(args);

            options = parseResults.MapResult(
                parsed => parsed,
                notParsed =>
            {
                return(default(Options));
            });

            if (options == default(Options))
            {
                return;
            }

            if (options.csvoutput != null)
            {
                //Create CSV file and write header row.
                csvFile = new CSVFile(options.csvoutput);

                var columnlist = new List <string>
                {
                    "Message#",
                    "Date Time",
                    "Routing Key",
                    "Exchange",
                    "Body"
                };

                csvFile.WriteRow(columnlist);

                var connectionString = options.AMQP;

                Console.WriteLine("Trace is running. Ctrl-C to exit");

                HandleDelivery();
                try
                {
                    using (ConnectAndSubscribe(connectionString))
                    {
                        tokenSource.Token.WaitHandle.WaitOne();
                    }

                    Console.WriteLine("Shutdown");
                }
                catch (Exception e)
                {
                    Console.Out.WriteLine(e.Message);
                }
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {

            
            Console.CancelKeyPress += (sender, eventArgs) =>
                {
                    eventArgs.Cancel = true;
                    tokenSource.Cancel();
                };

            if (Parser.Default.ParseArguments(args, options))
            {

                if (options.csvoutput != null)
                {
                    //Create CSV file and write header row.
                    csvFile = new CSVFile(options.csvoutput);

                    var columnlist = new List<string>
                        {
                            "Message#", 
                            "Date Time", 
                            "Routing Key", 
                            "Exchange", 
                            "Body"
                        };

                    csvFile.WriteRow(columnlist);

                }


                var connectionString = options.AMQP;

                Console.WriteLine("Trace is running. Ctrl-C to exit");

                HandleDelivery();
                try
                {

                    using (ConnectAndSubscribe(connectionString))
                    {
                        tokenSource.Token.WaitHandle.WaitOne();
                    }

                    Console.WriteLine("Shutdown");
                }
                catch (Exception e)
                {
                    Console.Out.WriteLine(e.Message);
                }
                
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Console.CancelKeyPress += (sender, eventArgs) =>
            {
                eventArgs.Cancel = true;
                tokenSource.Cancel();
            };

            if (Parser.Default.ParseArguments(args, options))
            {
                if (options.csvoutput != null)
                {
                    //Create CSV file and write header row.
                    csvFile = new CSVFile(options.csvoutput);