You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Craig Selbert <cr...@hotmail.com> on 2007/10/02 22:34:31 UTC

NMS implementation for Websphere MQ using C#

I am not sure if this is the right place to make this post but it seems
somewhat logical to me.  If it is not and someone else can point me in the
right direction it would be appreciated. With that said....

I am in the process of mapping the interfaces provided by NMS to WebSphere
MQ using C# when I ran into this line 96  in code file
SimpleMessageListenerContainer.cs.  Some NMS providers, such as WebSphere MQ
6.0, throw IllegalStateException...  I was hopping that maybe just maybe
that someone had attempted to do this already and either met with success. 
If they where not met with success then what obstacles did they run into.
-- 
View this message in context: http://www.nabble.com/NMS-implementation-for-Websphere-MQ-using-C--tf4557901s2354.html#a13007420
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Re: NMS implementation for Websphere MQ using C#

Posted by semog <e....@gmail.com>.

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.


Re: NMS implementation for Websphere MQ using C#

Posted by Craig Selbert <cr...@hotmail.com>.
Jim,

Thanks for the information.  If you could please post the sample you talked
about that would be great.  

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


Re: NMS implementation for Websphere MQ using C#

Posted by semog <e....@gmail.com>.
Hi Craig,

I think I understand what I was missing.  You are using the Spring.NET
framework.  That is why I didn't recognize the source file name that you
mentioned.  This mailing list is discussing the development of the Apache
NMS framework.  Now, bear with me, because this may be a bit confusing.  It
sure was for me when I first started looking in to it. :confused:

The Spring.Messaging.Nms framework is different from the Apache.NMS
framework.  As far as I know, their purpose is the same -- that is to allow
C# clients to send messages to a JMS broker such as ActiveMQ.  From the
documentation that I have read, it seems that there is an intention to
replace the current implementation of the Spring.Messaging.Nms library with
the Apache.NMS library.  However, I don't know who makes this decision, or
when it may occur.  When my company wanted to switch to ActiveMQ, I
researched the available frameworks.  The Spring.Messaging.Nms framework
didn't work, and seemed to have too much additional baggage with requiring
the Spring.NET library.  The Apache.NMS framework mostly worked, and began
to work very well after some bug fixes.  Unless you need the rest of the
Spring.NET framework, or if you are like me and only need a good open source
C# client that can connect to ActiveMQ (and now TIBCO), I would recommend
that you use the Apache.NMS framework.  It is smaller, and seems to be much
more stable.  Adding support for an additional provider such as MQSeries
should be pretty straightforward.  I am sure you could use my implementation
for TIBCO as a starting point and replace the TIBCO specific calls with the
MQSeries specific calls.  The Apache.NMS framework is very modular, and
adding support for a new provider is pretty straightforward.  Hiram and I
are in the middle of merging this new TIBCO provider implementation into the
main development trunk.

Browse around the  http://activemq.apache.org/nms/source.html Apache.NMS 
site so you can see what it is that we are working on.  This site took me a
while to find, because I was always being redirected to the Spring.NET site. 
I am glad I found it, though, because I think it is a simpler way to go for
NMS.

If you want a small sample code that shows how to use the Apache.NMS
framework, let me know and I will post a small sample app that sends and
consumes a simple "Hello, NMS!" text message.

- Jim


Craig Selbert wrote:
> 
> Jim,
> 
> OK, So here is what I have done and in the process of doing.  I was
> challenged with implementing the NMS framework with WebSphere MQ in .Net,
> so I started out by downloading the Spring.Net framework and the 
> http://www.springframework.net/modules.html NMS/TIBCO Modules  for the
> framework.  I then proceeded to create a new VS2005 project that
> referenced the NMS.dll, amqmdnet.dll, and the NMS Module and then started
> mapping the different interfaces from NMS to WebSphere MQ.  I did full
> code review of the NMS and TIBCO modules but not being familiar with
> ActiveMQ or TIBCO they only got me so far.  
> 
> I have a base implementation done but I know there is plenty of stuff I
> missed, but in the process of doing this coding I found in the code file
> of SimpleMessageListenerContainer.cs in the NMS module the comment about
> the WebSphere MQ 6.0 stuff and this lead to the post.  
> 
> I was/am hoping that someone else out there has tried to do this and I
> would love to know what roadblocks they ran into.  I know that I can get
> this to work for our business model but I would like to make it possible
> for others to use.
> 
> I hope this better explains what I am trying to do.  If there is something
> else anyone needs please let me know, and I would have ho problem
> complying.
> 
> Craig
> 

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


Re: NMS implementation for Websphere MQ using C#

Posted by Craig Selbert <cr...@hotmail.com>.
Jim,

OK, So here is what I have done and in the process of doing.  I was
challenged with implementing the NMS framework with WebSphere MQ in .Net, so
I started out by downloading the Spring.Net framework and the 
http://www.springframework.net/modules.html NMS/TIBCO Modules  for the
framework.  I then proceeded to create a new VS2005 project that referenced
the NMS.dll, amqmdnet.dll, and the NMS Module and then started mapping the
different interfaces from NMS to WebSphere MQ.  I did full code review of
the NMS and TIBCO modules but not being familiar with ActiveMQ or TIBCO they
only got me so far.  

I have a base implementation done but I know there is plenty of stuff I
missed, but in the process of doing this coding I found in the code file of
SimpleMessageListenerContainer.cs in the NMS module the comment about the
WebSphere MQ 6.0 stuff and this lead to the post.  

I was/am hoping that someone else out there has tried to do this and I would
love to know what roadblocks they ran into.  I know that I can get this to
work for our business model but I would like to make it possible for others
to use.

I hope this better explains what I am trying to do.  If there is something
else anyone needs please let me know, and I would have ho problem complying.

Craig


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


Re: NMS implementation for Websphere MQ using C#

Posted by semog <e....@gmail.com>.

Craig Selbert wrote:
> 
> I am in the process of mapping the interfaces provided by NMS to WebSphere
> MQ using C# when I ran into this line 96  in code file
> SimpleMessageListenerContainer.cs.  Some NMS providers, such as WebSphere
> MQ 6.0, throw IllegalStateException...  I was hopping that maybe just
> maybe that someone had attempted to do this already and either met with
> success.  If they where not met with success then what obstacles did they
> run into.
> 

Hi Craig,

I just got done mapping the NMS interfaces for TIBCO EMS, so I may be able
to
share my experiences with you.  However, I don't know where to find the file
you referenced in your post.  Would you provide a little more detail on the
exact problem you had?

Also, I am in the middle of packaging all of my changes up to submit them to
the project.  I would be interested to have you look over how I went about
implementing the interfaces for TIBCO.  There were definitely some issues
to be solved, and we may be able to share some solutions together.

Thanks,
Jim Gomes


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