Harley Blumenfeld created AMQNET-490:
----------------------------------------

             Summary: Stomp Client 1.5.4 error creating subscription to topic 
on JBoss HornetQ (Jboss 6.4.2 GA)
                 Key: AMQNET-490
                 URL: https://issues.apache.org/jira/browse/AMQNET-490
             Project: ActiveMQ .Net
          Issue Type: Bug
          Components: ActiveMQ, Stomp
    Affects Versions: 1.5.4
            Reporter: Harley Blumenfeld
            Assignee: Jim Gomes


Maybe I am doing something dumb, but using a simple example I cannot seem to 
get a topic subscription working using the Apache.NMS.Stomp version 1.5.4 
(http://activemq.apache.org/nms/apachenmsstomp-v154.html).

I am compiling the Stomp source code and project under .Net 4.0. I have created 
a console application in the Apache.NMS.Stomp solution. My program fails when 
it attempts to create a subscription to the topic. The same example works fine 
with the 1.5.3 version of the DLL so this seems like it could be a bug.

<b>Here is the result of my simple program:</b>
About to connect to stomp:tcp://myjboss:61613
Using destination: topic://jms.topic.test.topic
Connection Error: : Error creating subscription 
IDcSTHBLUMENF-50514-635475847768724525-1:0c1:1

Connection Error:
Error: : Error creating subscription 
IDcSTHBLUMENF-50514-635475847768724525-1:0c1:1

Error:   at Apache.NMS.Stomp.Connection.SyncRequest(Command command, TimeSpan 
requestTimeout) in 
C:\dev\Apache.NMS.Stomp\source\branches\1.5.4\src\main\csharp\Connection.cs:line
 525
   at Apache.NMS.Stomp.Connection.SyncRequest(Command command) in 
C:\dev\Apache.NMS.Stomp\source\branches\1.5.4\src\main\csharp\Connection.cs:line
 505
   at Apache.NMS.Stomp.Session.CreateConsumer(IDestination destination, String 
selector, Boolean noLocal) in 
C:\dev\Apache.NMS.Stomp\source\branches\1.5.4\src\main\csharp\Session.cs:line 
425
   at Apache.NMS.Stomp.Session.CreateConsumer(IDestination destination) in 
C:\dev\Apache.NMS.Stomp\source\branches\1.5.4\src\main\csharp\Session.cs:line 
379
   at TopicSubscriberTest.Program.Main(String[] args) in 
C:\dev\Apache.NMS.Stomp\source\branches\1.5.4\AmphoraTopicSubscribeTest\Program.cs:line
 31

<b>Here is the code:</b>
class Program
{                
        private static void Main(string[] args)
        {
                try
                {
                        var connecturi = new Uri("stomp:tcp://myjboss:61613");
                        Console.WriteLine("About to connect to " + connecturi);
                        IConnectionFactory factory = new 
NMSConnectionFactory(connecturi);

                        <b>using (IConnection connection = 
factory.CreateConnection("testuser", "test"))</b>
                        {
                                connection.ExceptionListener += new 
ExceptionListener(OnConnectionException);
                                connection.Start();

                                using (ISession session = 
connection.CreateSession())
                                {                        
                                        connection.Start();                     
   
                                        IDestination destination = 
SessionUtil.GetDestination(session,"topic://jms.topic.test.topic");
                                        Console.WriteLine("Using destination: " 
+ destination);
                                        using (IMessageConsumer consumer = 
session.CreateConsumer(destination))
                                        {                                       
                 
                                                consumer.Listener += OnMessage;
                                                while (true)
                                                {
                                                        Thread.Sleep(5000);
                                                        Console.WriteLine(".");
                                                }
                                        }
                                }
                        }
                }
                catch (Exception e)
                {
                        Console.WriteLine("Error:" + e.Message);
                        Console.WriteLine("Error:" + e.StackTrace);
                        Console.ReadLine();
                }
        }

        private static void OnConnectionException(Exception e)
        {
                Console.WriteLine("Connection Error:" + e.Message);
                Console.WriteLine("Connection Error:" + e.StackTrace);
        }

        protected static void OnMessage(IMessage receivedMsg)
        {
                var message = receivedMsg as ITextMessage;
                Console.WriteLine(message.Text);
        }
}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to