I don't see any obvious errors, have you checked to ensure that there is
something publishing to that Topic using the Web Console ?
Regards
Tim.
On Thu, 2009-09-03 at 12:47 -0700, gtsafas wrote:
> Here is my exact code
>
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS.ActiveMQ;
> using Apache.NMS;
> using Apache.NMS.Util;
> using System.Threading;
>
> namespace WindowsAuthenticator
> {
> class Authenticator
> {
> protected static ITextMessage message = null;
>
> static void Main(string[] args)
> {
> //if (args.Length < 2)
> //{
> // Console.WriteLine("Please specify the broker URL and
> Port");
> // Environment.Exit(0);
> //}
>
> //Authenticator authen = new Authenticator(args[0], args[1]);
> Authenticator authen = new Authenticator("192.168.42.30",
> "61616");
>
>
>
> }
>
> Authenticator(string uri, string port)
> {
> //brokerURI = uri;
> //this.port = port;
> try
> {
> Uri connecturi = new Uri("tcp://" + uri + ":" + port +
> "?wireFormat=openwire");
> Apache.NMS.ActiveMQ.ConnectionFactory factory = new
> ConnectionFactory(connecturi);
> IConnection connection = factory.CreateConnection();
> ISession session = connection.CreateSession();
>
> IDestination destination =
> SessionUtil.GetDestination(session, "topic://Topic.MD.Realtime.Stats");
> Console.WriteLine("Using destination: " + destination);
>
> IMessageConsumer consumer =
> session.CreateConsumer(destination);
> connection.Start();
> consumer.Listener += new MessageListener(OnMessage);
>
> Thread.Sleep(100000);
> }
> catch (Apache.NMS.NMSConnectionException e)
> {
> Console.WriteLine(e.Message);
> }
>
>
> }
>
> protected static void OnMessage(IMessage receivedMsg)
> {
> message = receivedMsg as ITextMessage;
> Console.WriteLine(message.Text);
> }
> }
> }
>
--
Tim Bish
http://fusesource.com
http://timbish.blogspot.com/