예제 #1
0
        public static void Main0L(String[] argv)
        {
            // Create an instance of this listener with the command line parameters.
            var rkl = new RoboKindConnectorQPID(RoboKindEventModule.RK_QPID_URI);
            //rkl.

            Console.WriteLine("Waiting for messages...");
            while (true)
            {
                if (rkl.shutdownReceivedEvt.WaitOne(TIMEOUT, true))
                {
                    Console.WriteLine("message was received");
                }
                else
                {
                    Console.WriteLine("timeout elapsed");
                }
            }
        }
 public void LoginToQPID(string uri)
 {
     if (RK_listener != null)
     {
         RK_listener.OnMessage -= AvroReceived;
     }
     try
     {
         RK_publisher = new RoboKindConnectorQPID(uri);
         RK_publisher.initRKListener(uri);
         RK_listener = RK_publisher.CreateListener(
             COGBOT_CONTROL_QUEUE_KEY,
             COGBOT_CONTROL_ROUTING_KEY,
             COGBOT_CONTROL_EXCHANGE_KEY,
             ExchangeNameDefaults.TOPIC, true, false, false,
             AvroReceived);
     }
     catch (Exception e)
     {
         RK_listener = null;
         RK_publisher = null;
         throw e;
     }
 }
예제 #3
0
        /// <summary>
        /// Start a test subscriber. The broker URL must be specified as the first command line argument.
        /// </summary>
        /// 
        /// <param name="argv">The command line arguments, broker URL first.</param>
        public static void Main0(String[] argv)
        {
            // Create an instance of this publisher with the command line parameters.
            RoboKindConnectorQPID publisher = new RoboKindConnectorQPID(RoboKindEventModule.RK_QPID_URI);
            //, RoboKindAvroQPIDModuleMain.COGBOT_CONTROL_ROUTING_KEY

            // Publish the test messages.
            publisher.SendTestMessage(RoboKindEventModule.REPORT_TEST, "DoTest");
        }
 public void Dispose()
 {
     EventsEnabled = false;
     if (RK_listener != null)
     {
         RK_listener.Close();
         RK_listener.OnMessage -= AvroReceived;
         RK_listener.Dispose();
     }
     if (RK_publisher != null)
     {
         RK_publisher.Shutdown();
     }
     RK_publisher = null;
 }