Esempio n. 1
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Waiting for messages");

                IConnectionFactory connectionFactory = EIPBusConnection.CreateOrGetConnection(new Uri("activemq:tcp://localhost:61616"));
                IConnection        connection        = connectionFactory.CreateConnection("admin", "admin");
                connection.Start();
                ISession         session  = connection.CreateSession();
                IDestination     dest     = session.GetQueue("DemoQueue");
                IMessageConsumer consumer = session.CreateConsumer(dest);
                // Read all messages off the queue
                while (ReadNextMessageQueue(session, consumer))
                {
                    Console.WriteLine("Successfully read message");
                }

                Console.WriteLine("Finished");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Console.WriteLine("Press <ENTER> to exit.");
                Console.Read();
            }
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();
            sequence = 0;
            IConnectionFactory connectionFactory = EIPBusConnection.CreateOrGetConnection(new Uri("activemq:tcp://localhost:61616"));
            IConnection        connection        = connectionFactory.CreateConnection("admin", "admin");

            session = connection.CreateSession();
            IDestination destination = SessionUtil.GetQueue(session, "DemoQueue");

            producer = producer = session.CreateProducer(destination);
            connection.Start();
        }