Github user tabish121 commented on a diff in the pull request:

    https://github.com/apache/activemq-nms-amqp/pull/2#discussion_r207644112
  
    --- Diff: src/example/csharp/HelloWorld/HelloWorld.cs ---
    @@ -0,0 +1,331 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +using System;
    +using System.Collections.Specialized;
    +using Apache.NMS;
    +using CommandLine;
    +
    +namespace HelloWorld
    +{
    +    class CommandLineOpts
    +    {
    +        // URI for message broker. Must be of the format 
amqp://<host>:<port> or amqps://<host>:<port>
    +        [Option("uri", Required = true, HelpText = "The URI for the AMQP 
Message Broker")]
    +        public string host { get; set; }
    +        // Connection Request Timeout
    +        [Option("ct", Default = 15000, HelpText = "the connection request 
timeout in milliseconds.")]
    +        public long connTimeout { get; set; }
    +        // UserName for authentication with the broker.
    +        [Option("cu", Default = null, HelpText = "The Username for 
authentication with the message broker")]
    +        public string username { get; set; }
    +        // Password for authentication with the broker
    +        [Option("cpwd", Default = null, HelpText = "The password for 
authentication with the message broker")]
    +        public string password { get; set; }
    +        [Option("cid", Default = null, HelpText = "The Client ID on the 
connection")]
    +        public string clientId { get; set; }
    +        // Logging Level
    +        [Option("log", Default = "warn", HelpText = "Sets the log level 
for the application and NMS Library. The levels are (from highest verbosity): 
debug,info,warn,error,fatal.")]
    +        public string logLevel { get; set; }
    +        //
    +        [Option("topic", Default = null, HelpText = "Topic to publish 
messages to. Can not be used with --queue.")]
    +        public string topic { get; set; }
    +        //
    +        [Option("queue", Default = null, HelpText = "Queue to publish 
messages to. Can not be used with --topic.")]
    +        public string queue { get; set; }
    +        //
    +        [Option('n', "messages", Default = 5, HelpText = "Number of 
messages to send.")]
    +        public int NUM_MSG { get; set; }
    +        //
    +        [Option("deliveryMode", Default = 5, HelpText = "Message Delivery 
Mode, Persistnent(0) and Non Persistent(1). The default is Persistent(0).")]
    +        public int mode { get; set; }
    +    }
    +    class Program
    +    {
    +        
    +        private static void RunWithOptions (CommandLineOpts opts)
    +        {        
    +            ITrace logger = new Logger(Logger.ToLogLevel(opts.logLevel));
    +            Tracer.Trace = logger;
    +
    +            string ip = opts.host;
    +            Uri providerUri = new Uri(ip);
    +            Console.WriteLine("scheme: {0}", providerUri.Scheme);
    +
    +            StringDictionary properties = new StringDictionary();
    +            //properties["clientId"] = "guest";
    +            if(opts.username !=null)
    +                properties["NMS.username"] = opts.username;
    +            if(opts.password !=null)
    +                properties["nms.password"] = opts.password;
    +            if (opts.clientId != null)
    +                properties["NMS.CLIENTID"] = opts.clientId;
    +            //properties["nms.clientid"] = "myclientid1";
    +            properties["NMS.sendtimeout"] = opts.connTimeout+"";
    +            IConnection conn = null;
    +            if (opts.topic == null && opts.queue == null)
    +            {
    +                Console.WriteLine("ERROR: Must specify a topic or queue 
destination");
    +                return;
    +            }
    +            try
    +            {
    +
    +
    --- End diff --
    
    There's a decent amount of scattered extra white space in here that could 
be cleaned up while making other changes


---

Reply via email to