Mqseries Using Java Pdf
The issue here is the requirement that 'My boss asked me to use pure java JMS (not ibm.mq lib) to do that.' JMS is a specification and each implementation must comply with the API and the semantics, but is free to do whatever they want at a low level.
Vi WebSphere MQ Primer: An Introduction to Messaging and WebSphere MQ. Java, and all Java-based. 2 WebSphere MQ Primer: An Introduction to Messaging and. MQSeries Programming Patterns Mark Perry Manesh Balachandran Jorge Plata. Technics Rs-m224 Manual. 7.4 Working with MQSeries Java API.
It is always necessary to use the implementation classes provided by the transport vendor. Therefore if you use WebSphere MQ as the transport, you will need to use the IBM MQ JMS classes to write a JMS application.
That said, if you stick with pure JMS API calls you would be able to plug in any transport vendor's classes. This is what is usually intended when you are given requirements such as that mentioned in the original post. There's an article describing exactly what you are looking to do called It uses only the JMS API and it uses JNDI in a local file system (a.bindings file). By swapping out the IBM JMS classes for another vendor and using their JNDI tools you would be able to plug in any JMS transport without changing your code using this approach. If you want to do the same thing without JNDI, look at the sample programs provided with the MQ client install where you obtained your Java classes.
In a UNIX/Linux system these are in /opt/mqm/samp and on Windows they are in install_dir/tools/jms/samples. 'Therefore if you use WebSphere MQ as the transport, you will need to use the IBM MQ JMS classes to write a JMS application.' I believe that is only true if you are working directly with MQ. If you are abstracted via a container such as WebSphere Application Server, you can actually write 'pure JMS' code as the app container takes care of you working with MQ same as if you worked with the SIBus implementation. All you have to do is make sure your MQ Queues are defined as JMS 'Queues' and that you have a QueueConnectionFactory (interfaceing with as if it was a ConnectionFactory).
– Aug 4 '11 at 16:28 •. This is an interesting semantic dance. The transport provider's JMS classes are in the CLASSPATH one way or another. In your example, the JEE server provides a container within which the IBM MQ JMS libraries are accessed.
But either way, the application is still using those specific classes and can access their vendor-specific methods. It is not as though the JEE server somehow hides the vendor implementation from the app so it seems a meaningless distinction to me. Also, OP specified a stand-alone JMS app so presumably there's no JEE container in his scenario anyway. – Aug 4 '11 at 17:01 •. Typically with JMS you would define the QueueConnectionFactory in your container via whatever configuration mechanism it makes available then add it to the container's JNDI registry. Each container would have it's own methods for doing that (i.e.
Tomcat versus WebSphere). If you want to forgo JNDI, you could create an instance of directly and set the hostname, port, queueManager, and channel properties on it. You can then use that object as you would an instance of javax.jms.QueueConnectionFactory since it implements it.