Author |
Message
|
maruthi_P2003 |
Posted: Mon Dec 29, 2003 3:31 am Post subject: Get Messages from the Queue |
|
|
Acolyte
Joined: 09 Dec 2003 Posts: 63
|
Hi,
i am new to this Mq env.
how can we get the Messages from the Queue?
As my understanding( from docs&msg in forum) we need to be in
get and wait mode(not unlimited wait and Polling)..
My Question is
1)how can i Retrive Response Message from my Queue(if there are so many messages in a Queue) since Msgid,Correlationid are different for the Res Meg. Is there any way of Mapping of
msgid to Corrid in the Response message??
nothing is written anywhere...i have gone through "Using Java"..and other pdfs docs of IBM. And have seen the JMS exp too...there are some good exp using JMS...
(there are all point-point,pub-sub code.).
sample code using base classes of java to get mess
// Open to get messages with exclusive access.
int openOptions =MQC.MQOO_INPUT_EXCLUSIVE | MQC.GMO_FAIL_IF_QUIESCING;
gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID | MQC.MQMO_MATCH_MSG_ID;
MQQueue myQueue =qMgr.accessQueue( "Testq", openOptions, null, null, null);
myQueue.get(myMessage, gmo);
it will only feath a msg not looks for msgid,corrid..what need to be chaged,?
i am writing a sample program to feath the msg based in msgid or corrid..
2) since there In MQBase Classes(there are no classes for accessing the Topic,session ..etc)..
how can i pub-sub to topics..?its all confusing to me...?? i want to develop Pub and sub app.
Plz help.. |
|
Back to top |
|
 |
zpat |
Posted: Mon Dec 29, 2003 4:28 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
If you are sharing a queue for the replies (and the alternative is to have your own reply queue and specify the name of it in the "reply-to-queue" field in the message) then you need to select your reply message by correlid.
Your server program should move the incoming msgid id to the response message correlid, and also reply to the queue specified in the "reply-to-q" field (if present).
You have to tell MQ what correlid value to look for (save the request message msgid value). Nothing is automatic here, MQSeries does not know that the request and reply are related.
Think about message expiry etc. To construct a fully working, reliable client/server design with MQSeries is simple to an expert but full of potential problems to a newbie. My advice is to get help from an expert (and not just on here). |
|
Back to top |
|
 |
maruthi_P2003 |
Posted: Mon Dec 29, 2003 5:11 am Post subject: |
|
|
Acolyte
Joined: 09 Dec 2003 Posts: 63
|
hi,
thanks for the Reply.Anyway i am using the Reply Queue.
plz answer my second Question..PLz tel me if You have any tutorial other than this IBM pdfs.
and i Learned a lot on reading the topics in the Forum.Iam thankfull to every body for the fast response and help for the newbies like me.
regards. |
|
Back to top |
|
 |
zpat |
Posted: Mon Dec 29, 2003 7:48 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
I've never written a pub/sub application but I understand that it's a matter of constructing the correct RFH2 headers.
Are you talking base MQ pub/sub or MQSI pub/sub? You need to have some sort of pub/sub engine in the middle for it to work.
You might try attending an IBM course on MQSeries.
I think that for people to just "have a go" at becoming MQ developers without training is about as desirable as to "have a go" at brain surgery! |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Dec 29, 2003 8:11 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
zpat wrote: |
I've never written a pub/sub application but I understand that it's a matter of constructing the correct RFH2 headers. |
And, um, having a broker to actually PUB the messages to the SUBs. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
maruthi_P2003 |
Posted: Mon Dec 29, 2003 6:07 pm Post subject: |
|
|
Acolyte
Joined: 09 Dec 2003 Posts: 63
|
Hi Jeff,
Yes. U r right .I am using the MQbroker 2.1 on WMQ5.3 for my pub/sub app.
plz help me the 2 nd question.
regards |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Dec 30, 2003 5:18 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
maruthi_P2003 wrote: |
Hi Jeff,
Yes. U r right .I am using the MQbroker 2.1 on WMQ5.3 for my pub/sub app.
plz help me the 2 nd question.
|
It's a little unclear what you mean by "MQbroker 2.1".
I'll take that to mean "Websphere MQSeries Integrator Broker 2.1", which is the version of Websphere MQSeries Integrator that does not include the NNSY modeller.
In terms of "other documentation" for Pub/Sub than IBM pdfs... There might be some documents on the Sun site, that describe the JMS Pub/Sub standard. But unless you're using JMS, that won't help.
The best document I know of for MQSeries Pub/Sub, particularly with WMQI, is the WMQI Programming Guide manual - which is an IBM PDF.
There may also be examples on IBM's developer site. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Dec 31, 2003 8:54 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I'm not sure that your second question ever got 100% answered. If you want to do pub/sub using the base java APIs, you'll need to build an RFH2 header yourself. There are some sample programs (the soccer game) that you can look at that do this.
Personally, I find using JMS to do pub/sub a lot easier to deal with. The RFH2 header manipulation is done for you. There are a couple of samples at:
http://www.developer.ibm.com/tech/sampmq.html
They are called mqjmssub.java and mqjmspub.java. They might be a good place to start looking. |
|
Back to top |
|
 |
maruthi_P2003 |
Posted: Wed Dec 31, 2003 9:52 pm Post subject: |
|
|
Acolyte
Joined: 09 Dec 2003 Posts: 63
|
hi bower,
Thanks for the good link and help.
I am dev using Java Base Classes for my App.
Can Anybody tell me which API is better in Performance wise (JMS or MQSI(BaseClasses), AMI) , Since Which one You suggest Better.
I know each one has some differances with other API and would like know whats the Performance, advantages of JMS with Other APIs like AMI or MQSI Base Classes?
Regards |
|
Back to top |
|
 |
|