Craig Selbert wrote:
> 
> Jim,
> 
> Thanks for the information.  If you could please post the sample you
> talked about that would be great.  
> 
> Craig
> 

Hi Craig,

Here you go.  This is based on the changes that I am contributing.  Still
working through all of the legal due diligence, but I think the contribution
will be committed to the mainline soon.


using System;
using Apache.NMS;

namespace Apache.TibcoEMS.Test
{
        class TestTibco
        {
                static void Main(string[] args)
                {
                        IConnectionFactory connectionFactory =
NMSFactory.CreateConnectionFactory("tibco:tcp://testmachine:7222",
"TestTibcoClient");
                        if(null != connectionFactory)
                        {
                                using(IConnection connection =
connectionFactory.CreateConnection("guest", "guest"))
                                using(ISession session =
connection.CreateSession(AcknowledgementMode.AutoAcknowledge))
                                {
                                        IQueue publishQueue = 
session.GetQueue("TestQueue");
                                        using(IMessageProducer producer = 
session.CreateProducer(publishQueue))
                                        using(IMessageConsumer consumer = 
session.CreateConsumer(publishQueue))
                                        {
                                                // Send a message to the queue 
we are consuming on.
                                                ITextMessage message = 
producer.CreateTextMessage("Hello, NMS!");

                                                // Start receiving connection 
messages.
                                                connection.Start();
                                                producer.Send(message);

                                                ITextMessage reply = 
consumer.Receive() as ITextMessage;

                                                if(null != reply)
                                                {
                                                        
Console.WriteLine(reply.Text);
                                                }
                                                else
                                                {
                                                        Console.WriteLine("You 
never write messages anymore!");
                                                }
                                        }
                                }
                        }
                        else
                        {
                                Console.Write("Error creating connection 
factory.");
                        }
                }
        }
}

-- 
View this message in context: 
http://www.nabble.com/NMS-implementation-for-Websphere-MQ-using-C--tf4557901s2354.html#a13147041
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Reply via email to