You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by gtsafas <gt...@rblt.com> on 2009/09/03 19:56:22 UTC
NMS: Error when trying to connect to a broker
I am trying to write a client connect to our activemq in c#.
When I try to compile I am recieving this error
No IConnectionFactory implementation found for connection URI:
activemq:tcp://192.168.1.13:61616
I am using the net 3.5 lib Apache.NMS 1.1.0.1642
I am calling this using
IConnectionFactory factory = new
NMSConnectionFactory(connecturi);
Here is my code;
using System;
using System.Collections.Generic;
using System.Text;
using Apache.NMS;
using Apache.NMS.Util;
namespace WindowsAuthenticator
{
class Authenticator
{
protected static ITextMessage message = null;
static void Main(string[] args)
{
Authenticator authen = new Authenticator("192.168.42.30",
"61616");
}
Authenticator(string uri, string port)
{
Uri connecturi = new Uri("activemq:tcp://" + uri + ":" + port);
IConnectionFactory factory = new
NMSConnectionFactory(connecturi);
using (IConnection connection = factory.CreateConnection())
using (ISession session = connection.CreateSession())
{
IDestination destination =
SessionUtil.GetDestination(session, "topic://Topic.MD.Realtime.Stats");
Console.WriteLine("Using destination: " + destination);
using (IMessageConsumer consumer =
session.CreateConsumer(destination))
{
connection.Start(); // Must start the connection for
async messaging.
consumer.Listener += new MessageListener(OnMessage);
}
}
}
protected static void OnMessage(IMessage receivedMsg)
{
message = receivedMsg as ITextMessage;
Console.WriteLine(message.Text);
}
}
}
Thanks ahead of time for the help.
--
View this message in context: http://www.nabble.com/NMS%3A-Error-when-trying-to-connect-to-a-broker-tp25281112p25281112.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.