Ejemplo n.º 1
0
        public void start()
        {
            IMessagingBus bus = MQFactory.Instance.createMessagingBus();

            try {
                Console.WriteLine("Creating connector");
                clientConnection = bus.connect(new Uri("bnmq://127.0.0.1:3333"));
                clientConnection.addListener(new MQConnectionListener(this));
                clientConnection.start();

                //doSubscribe();
                Console.WriteLine("Please enter to exit");
                Console.ReadKey();
                //System.in.read();
                Console.WriteLine("Trying to stop example queue dispatcher");
            }
            catch (Exception e) {
                Console.WriteLine(e.ToString());
            }
            finally {
                if (queue != null)
                {
                    Console.WriteLine("Trying to stop receiveing from remote queue");
                    queue.stop();
                }
                if (clientConnection != null)
                {
                    Console.WriteLine("Trying to close connector");
                    clientConnection.close();
                }

                if (bus != null)
                {
                    Console.WriteLine("Trying to finallize messaging bus");
                    bus.close();
                }
            }
        }