Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {
                ConnectionFactory connectionFactoryTest = new ConnectionFactory(URI);

                using (SimpleMessageListenerContainer listenerTest = new SimpleMessageListenerContainer())
                {
                    listenerTest.ConnectionFactory = connectionFactoryTest;
                    listenerTest.DestinationName = queueName;
                    listenerTest.MessageListener = new ListenerTest();
                    listenerTest.AfterPropertiesSet();
                    listenerTest.Start();

                    Console.WriteLine("Listening to Queue.");
                    Console.WriteLine("[Main]: Press <ENTER> to exit.");
                    Console.Read();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Console.WriteLine("[Exception]: Press <ENTER> to exit.");
                Console.Read();
            }
        }
        static void Main(string[] args)
        {
            try
            {
                ConnectionFactory connectionFactory = new ConnectionFactory(URI);
                connectionFactory.UserName = USER;
                connectionFactory.Password = PASS;

                using (SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer())
                {
                    listenerContainer.ConnectionFactory = connectionFactory;
                    listenerContainer.DestinationName = DESTINATION;
                    listenerContainer.MessageListener = new Listener();
                    listenerContainer.AfterPropertiesSet();
                    Console.WriteLine("Listener started.");
                    Console.WriteLine("Press <ENTER> to exit.");
                    Console.ReadLine();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Console.WriteLine("Press <ENTER> to exit.");
                Console.Read();
            }
            // comment when testing
            Console.ReadLine();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var activeMQConnection = new ConnectionFactory("tcp://localhost:61616");
            //var nmsTemplate = new NmsTemplate(activeMQConnection);
            //nmsTemplate.DefaultDestination = new ActiveMQQueue("mathias");

            var myDtoListener = new MyDtoMessageListener();
            myDtoListener.OnNewMessage += new EventHandler<MyDtoEventArgs>(myDtoListener_OnNewMessage);

            var listener = new SimpleMessageListenerContainer();
            listener.ConnectionFactory = activeMQConnection;
            listener.Destination = new ActiveMQQueue("mathias");
            listener.MessageListener = myDtoListener;
            listener.Initialize();

            // WCF (.Net 3)
            var client = new localhost.MyServiceClient();
            // .Net 2
            //localhost.MyServiceImplService client = new localhost.MyServiceImplService();
            var result = client.test();
            Console.WriteLine(String.Join(" - ", result.data2d[0].ToArray()));

            Console.WriteLine("Press a key to exit");
            Console.ReadKey(true);
        }
 public SimpleMessageListener(SimpleMessageListenerContainer container, ISession session)
 {
     this.container = container;
     this.session   = session;
 }
 public void Setup()
 {
    mocks = new MockRepository();
    container = new SimpleMessageListenerContainer();
 }
Ejemplo n.º 6
0
 public Listener(SimpleMessageListenerContainer container)
 {
     this.container = container;
     Console.WriteLine("Listener created.");
 }
 public SimpleMessageListener(SimpleMessageListenerContainer container, ISession session)
 {
     this.container = container;
     this.session = session;
 }