[
https://issues.apache.org/activemq/browse/AMQNET-6?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
james strachan moved AMQ-865 to AMQNET-6:
-----------------------------------------
Fix Version/s: (was: 4.1.0)
1.0
Component/s: (was: NMS (C# client))
Key: AMQNET-6 (was: AMQ-865)
Project: ActiveMQ .Net (was: ActiveMQ)
> C# Client's Listener doesn't receive messages if you don't explicitly call
> Subscribe
> ------------------------------------------------------------------------------------
>
> Key: AMQNET-6
> URL: https://issues.apache.org/activemq/browse/AMQNET-6
> Project: ActiveMQ .Net
> Issue Type: Bug
> Environment: Windows XP, VS 2005, ActiveMQ 4.0.1
> Reporter: Denis Abramov
> Fix For: 1.0
>
>
> 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>
> [STAThread]
> 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!");
> }
> else
> {
> Console.WriteLine("Received message with text: " +
> ((ActiveMQTextMessage)message).Text);
> }
> }
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.