activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MikeyBoy <>
Subject C# NMS client
Date Mon, 25 Sep 2006 19:02:03 GMT

Hi, I'm attempting to write an NMS C# client. I just want to get a simple
example client going. I have done the following:

1) downloaded C# code from:

2) placed above files (*.cs) in a project and built an NMS dll, which builds

3) have created a 2nd VSCS project to test the NMS, which references
NMS.dll. It includes the code from here:, which is also shown below.

4) Question, when I try to build the code in 3) above (and shown below), I
get an error..."ConnectionFactory" is not defined.  Where is it defined? I
noticed IConnectionFactory is somwhere it must be defined?

Thanks, MikeyBoy

------code from
IConnectionFactory factory = new ConnectionFactory(new
using (IConnection connection = factory.CreateConnection())
    Console.WriteLine("Created a connection!");
    ISession session = connection.CreateSession();
    IDestination destination = session.GetQueue("FOO.BAR");
    Console.WriteLine("Using destination: " + destination);
    // lets create a consumer and producer
    IMessageConsumer consumer = session.CreateConsumer(destination);
    IMessageProducer producer = session.CreateProducer(destination);
    producer.Persistent = true;
    // lets send a message
    ITextMessage request = session.CreateTextMessage("Hello World!");
    request.NMSCorrelationID = "abc";
    request.Properties["JMSXGroupID"] = "cheese";
    request.Properties["myHeader"] = "James";
    // lets consume a message
    ActiveMQTextMessage message = (ActiveMQTextMessage) consumer.Receive();
    if (message == null)
        Console.WriteLine("No message received!");
        Console.WriteLine("Received message with ID:   " +
        Console.WriteLine("Received message with text: " + message.Text);

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message