activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Abramov (JIRA)" <>
Subject [jira] Created: (AMQ-865) C# Client's Listener doesn't receive messages if you don't explicitly call Subscribe
Date Mon, 07 Aug 2006 15:46:23 GMT
C# Client's Listener doesn't receive messages if you don't explicitly call Subscribe

                 Key: AMQ-865
             Project: ActiveMQ
          Issue Type: Bug
          Components: NMS (C# client)
         Environment: Windows XP, VS 2005, ActiveMQ 4.0.1
            Reporter: Denis Abramov

 Easiest way to reproduce the bug would be to start the consumer using the following code
and then AFTER the consumer starts, start some producer (either java or C#) and you will notice
that the consumer will not get any messages (through trial and error I found that calling
Receive() on the consumer at least once will make you lose a message but the listener will
kick back in): 

using System; 
using ActiveMQ; 
using ActiveMQ.Commands; 
using NMS; 

namespace JMSClient 
    /// <summary> 
    /// Summary description for Class1. 
    /// </summary> 
    class Class1 
        /// <summary> 
        /// The main entry point for the application. 
        /// </summary> 
        static void Main(string[] args) 
            IConnectionFactory factory = new ConnectionFactory(new Uri("tcp://localhost:61616?jms.useAsyncSend=true"));

            using (IConnection connection = factory.CreateConnection()) 
                Console.WriteLine("Created a connection!"); 

                ISession session = connection.CreateSession(); 
                IDestination destination = session.GetQueue("EXCEL.TESTQUEUE"); 
                Console.WriteLine("Using destination: " + destination); 

                // lets create a consumer and producer 
                IMessageConsumer consumer = session.CreateConsumer(destination); 
                consumer.Listener += new MessageListener(consumer_Listener); 

                while (true); 

        static void consumer_Listener(IMessage message) 
            if (message == null) 
                Console.WriteLine("No message received!"); 
                Console.WriteLine("Received message with text: " + ((ActiveMQTextMessage)message).Text);


This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message