Author |
Message
|
muhilan |
Posted: Fri Aug 29, 2008 12:40 pm Post subject: MQSeries - sending messages from one MQ queue to another |
|
|
Novice
Joined: 29 Aug 2008 Posts: 11
|
I am new to JMS and MQSeries. I wish to write a subscription module in which the code would take messages from one queue and send it to various queues. The queue is read in subscription mode. The requester queues that receive the messages would need to send a response back to the message-originating queue.
Thanks in advance |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Aug 29, 2008 6:35 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I would suggest that you read up on pub/sub and visit a tutorial. Sun has a good one. You have all your terms and key words confused.
If you can "talk the talk" you obviously can't "walk the walk" yet.
Studying a good tutorial for JMS will be your next step to get there.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
muhilan |
Posted: Sat Aug 30, 2008 7:07 am Post subject: point-to-point or publish/subscribe with one to many |
|
|
Novice
Joined: 29 Aug 2008 Posts: 11
|
hi
thanks for the direction. My apologies for being naive. After a glance at the Sun tutorial I see that my problem could be about using the publish-subscribe model (one to many).
Still not sure though, if I am getting my terms right!!
thanks |
|
Back to top |
|
 |
zpat |
Posted: Sat Aug 30, 2008 8:07 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
You want a simple fan out app.
Unless you really need the flexibility of pub sub then just code a little app to GET messages from one queue and PUT them to more than one queue (either repeat the PUT or use a Distribution List).
No need to over-complicate things! |
|
Back to top |
|
 |
muhilan |
Posted: Sat Aug 30, 2008 7:28 pm Post subject: app to GET messages from one queue and PUT them to more.. |
|
|
Novice
Joined: 29 Aug 2008 Posts: 11
|
If I want to code "a little app to GET messages from one queue and PUT them to more than one queue (either repeat the PUT or use a Distribution List)" is there any sample app that I can develop upon?
thanks again |
|
Back to top |
|
 |
zpat |
Posted: Sun Aug 31, 2008 9:15 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
MQCONN queuemanager
MQOPEN input queue
MQOPEN output queue1
MQOPEN output queue2 etc
MQGET input queue
MQPUT output queue1
MQPUT output queue2 etc
Repeat until MQRC 2033 on the MQGET
MQCLOSE input queue
MQCLOSE output queue1
MQCLOSE output queue2
MQDISC
It's that easy. You could add syncpointing to ensure consistency. Plus of course the usual error handling.
There are some IBM JMS samples, search this site to the find the URL. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Aug 31, 2008 9:51 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
zpat wrote: |
MQCONN queuemanager
MQOPEN input queue
MQOPEN output queue1
MQOPEN output queue2 etc
MQGET input queue
MQPUT output queue1
MQPUT output queue2 etc
Repeat until MQRC 2033 on the MQGET
MQCLOSE input queue
MQCLOSE output queue1
MQCLOSE output queue2
MQDISC
It's that easy. You could add syncpointing to ensure consistency. Plus of course the usual error handling.
There are some IBM JMS samples, search this site to the find the URL. |
And please note that zpat gave you the basics for java "base" programming.
JMS is a different animal and much more provider independent.
You were right with the pub/sub model.
To ease your "pain" you should start with point to point (P2P) and use a producer and a consumer. Be aware that transactionality is handled at the session level. There are excellent sample programs but going through the tutorial first will give you a good grasp of the concepts instead of just having you code stuff without knowing why...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Aug 31, 2008 10:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
fjb_saper wrote: |
zpat wrote: |
MQCONN queuemanager
MQOPEN input queue
MQOPEN output queue1
MQOPEN output queue2 etc
MQGET input queue
MQPUT output queue1
MQPUT output queue2 etc
Repeat until MQRC 2033 on the MQGET
MQCLOSE input queue
MQCLOSE output queue1
MQCLOSE output queue2
MQDISC
It's that easy. You could add syncpointing to ensure consistency. Plus of course the usual error handling.
There are some IBM JMS samples, search this site to the find the URL. |
And please note that zpat gave you the basics for java "base" programming. |
No, actually, he didn't. That's the basis for the PROCEDURAL MQ API, which is not actually available in Java, since Java is a purely object oriented language.
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=/com.ibm.mq.csqzaw.doc/ja10990_.htm |
|
Back to top |
|
 |
muhilan |
Posted: Sun Aug 31, 2008 10:27 am Post subject: what should be the environment? |
|
|
Novice
Joined: 29 Aug 2008 Posts: 11
|
I have installed WebSphere Application Server V6 for Windows.
I am also trying to install WebSphere MQ (to act as a JMS Provider..)and Rational Application Developer as well.
In order to use the PROCEDURAL MQ API, WebSphere MQ Java, what is the recommended software environment that I need to have before developing. |
|
Back to top |
|
 |
zpat |
Posted: Sun Aug 31, 2008 12:17 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
AFAIK the JMS wrapper simply maps to MQI calls.
The underlying MQI operations have to take place, no matter what fancy names you give to them. More importantly they must be understood by any MQ developer.
Seems to me that recommending pub/sub to someone who perhaps doesn't understand basic MQ concepts is like taking a first driving lesson in a racing car - not the best idea. |
|
Back to top |
|
 |
muhilan |
Posted: Sun Aug 31, 2008 1:45 pm Post subject: realize this is not easy |
|
|
Novice
Joined: 29 Aug 2008 Posts: 11
|
I admit I did not know even basic JMS until I studied up the basic JMS API concepts.
Admitted the whole thing is frustrating for an expert to try and explain things to a newbie, but I am determined to get my feet wet without too much help-taking.
Thanks again |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Aug 31, 2008 8:23 pm Post subject: Re: realize this is not easy |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
muhilan wrote: |
I admit I did not know even basic JMS until I studied up the basic JMS API concepts.
Admitted the whole thing is frustrating for an expert to try and explain things to a newbie, but I am determined to get my feet wet without too much help-taking.
Thanks again |
Form his first post he is clearly going the JMS route.
So let him get a good grasp on the JMS API and how to use it first.
Little steps my friend.
ConnectionFactory, Connection, Session, Consumer | Producer _________________ MQ & Broker admin |
|
Back to top |
|
 |
muhilan |
Posted: Mon Sep 01, 2008 6:35 am Post subject: which Java Message Service Specification version? |
|
|
Novice
Joined: 29 Aug 2008 Posts: 11
|
Which version of JMS should I use. On the Sun Website they have Java Message Service Specification - version 1.1 on http://java.sun.com/products/jms/docs.html
I have Java 6 and the GlassFish server on my PC.
Please advise on: Appropriate JMS version for my current Java environment.
thanks |
|
Back to top |
|
 |
muhilan |
Posted: Mon Sep 01, 2008 10:32 am Post subject: Re: realize this is not easy |
|
|
Novice
Joined: 29 Aug 2008 Posts: 11
|
fjb_saper wrote: |
Form his first post he is clearly going the JMS route.
So let him get a good grasp on the JMS API and how to use it first.
Little steps my friend.
ConnectionFactory, Connection, Session, Consumer | Producer |
I got my GlassFish server running. I think there is some JMS version bundled in GlassFish (and I think it is 1.1 .) Not 100%sure. I figured out that I have to create a ConnectionFactory that can do both publish/subscribe tasks. I also need to implement the onMessage method in an MDB..
I am going to try and see if this thing works. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Sep 01, 2008 3:03 pm Post subject: Re: realize this is not easy |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
muhilan wrote: |
fjb_saper wrote: |
From his first post he is clearly going the JMS route.
So let him get a good grasp on the JMS API and how to use it first.
Little steps my friend.
ConnectionFactory, Connection, Session, Consumer | Producer |
I got my GlassFish server running. I think there is some JMS version bundled in GlassFish (and I think it is 1.1 .) Not 100%sure. I figured out that I have to create a ConnectionFactory that can do both publish/subscribe tasks. I also need to implement the onMessage method in an MDB..
I am going to try and see if this thing works. |
Once you have achieved this with standard JMS (Sun) you can look into reading the Using Java manual. For JNDI provider may I suggest the FileSystem provider (It is one of the sun.com.jndi.RefFS* delivered with MQ). All you need to do now is reference correctly the MQ JNDI file and have all MQ jars on the classpath. We recommend at least an MQ client installation. You can then switch the standard JMS provider to MQ.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|