ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Unable to get Message using recieve() Method of JMS API

Post new topic  Reply to topic Goto page Previous  1, 2
 Unable to get Message using recieve() Method of JMS API « View previous topic :: View next topic » 
Author Message
jefflowrey
PostPosted: Thu Aug 17, 2006 2:54 am    Post subject: Re: RE: Unable to get Message using recieve() Method of JMS Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

ganesh3 wrote:
Also, I would be using the JNDI name to look up the Reply Queue Manager.


No, you should not.

You should use JNDI to look up the queue connection factory for building the connection to send the reply. You've probably already got a good connection for receiving the request, so you probably don't even need to do this.

Then you should take both the queue manager name and the queue name for the reply from the request message, and use both of those to build the reply destination.

The queue manager the connection is made to does not need to be the same as the queue manager the message is addressed to.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
ganesh3
PostPosted: Thu Aug 17, 2006 3:01 am    Post subject: RE: Unable to get Message using recieve() Method of JMS Reply with quote

Apprentice

Joined: 30 Mar 2006
Posts: 35

Hi,
So if my queue name(JNDI) is "queue1.was.reply" and the queue manager name is "abc000" then the following will be the correct way of creting a destination.

Destination mydest = Session.createQueue("queue://abc000/queue1.was.reply");

I hope this is correct.

Thanks,

Ganesh Bhat.
_________________
Have a Good Day!!!
Back to top
View user's profile Send private message Yahoo Messenger
fjb_saper
PostPosted: Thu Aug 17, 2006 3:19 am    Post subject: Re: RE: Unable to get Message using recieve() Method of JMS Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

ganesh3 wrote:
Hi,
So if my queue name(JNDI) is "queue1.was.reply" and the queue manager name is "abc000" then the following will be the correct way of creting a destination.

Destination mydest = Session.createQueue("queue://abc000/queue1.was.reply");

I hope this is correct.

Thanks,

Ganesh Bhat.


No if your queue is retrieved from JNDI you should use following

Code:
Queue myreplyqueue = (Queue)context.lookup("myreplyqueue");
mymsg.setJMSReplyTo(myreplyqueue);


Now remember that myreplyqueue is and object of type Destination and you should use this at the server side to either create the sender or pass to the sender on the send method in case of an "anonymous" sender.

You will extract it using
Code:
Destination replyto =mymsg.getJMSReplyTo();


Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ganesh3
PostPosted: Thu Aug 17, 2006 3:59 am    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2006
Posts: 35

Hi,
I was suggested to do this while sending a request message.

Destination mydest = Session.createQueue("queue://abc000/queue1");
message.setJMSReplyTo(mydest);

where
abc000 --> the queue manager name
queue1 --> is the queue name

I wanted to enquire whether the queue name should be the JNDI name of the queue or real name of the queue.

Also, by doing this ,would I ensure that all the reply messages i get would be on the Queue manager Name set using the setJMSReplyto() method and the corresponding queue. I am not sure if my conclusion is correct. Kindly confirm.

Thanks,

Ganesh Bhat.
_________________
Have a Good Day!!!
Back to top
View user's profile Send private message Yahoo Messenger
jefflowrey
PostPosted: Thu Aug 17, 2006 4:19 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

On the requester side, you can lookup the JNDI destination that you want to retrieve your messages on, this should include the queue manager name in the JNDI definition.

On the replier side, you can not lookup a JNDI destination to send the reply to, you must use JMSReplyTo on the message.

In both cases, these will be Destination objects, and you don't have to worry about what the real queue is behind them.

Now, if you are actually not looking up the reply queue on the REQUESTOR side, then you can build it as you've done with createQueue, and it has to include both the real queue name and the real queue manager name.

If you really really wanted to, you could attempt to misuse the JMSReplyTo field, and populate only a JNDI name in there. Then the server would also have to misuse the JMSReplyTo field and treat it as a String and then go lookup the destination from it. This is a bad idea.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
ganesh3
PostPosted: Thu Aug 17, 2006 4:53 am    Post subject: RE: Unable to get Message using recieve() Method of JMS Reply with quote

Apprentice

Joined: 30 Mar 2006
Posts: 35

Hi,
Thanks everybody for all your suggestion. I would be using the real queue and queue manager name and hope that it works.
One thing that I would like to ask was that we can provide attributes in the createQueue statement below

Quote:
Destination mydest = Session.createQueue("queue://QMGRNAME/QNAME?att1=val1&attn=valn");


I could not find the attribute list in the JMS API documentation. Can any body provide me a link or the list of properties where I can look it up?

Thanks,

Ganesh Bhat.
_________________
Have a Good Day!!!
Back to top
View user's profile Send private message Yahoo Messenger
Vitor
PostPosted: Thu Aug 17, 2006 4:58 am    Post subject: Re: RE: Unable to get Message using recieve() Method of JMS Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

ganesh3 wrote:

I could not find the attribute list in the JMS API documentation. Can any body provide me a link or the list of properties where I can look it up?


Using Java manual, Table 13 "Property names for queue and topic URIs", page 320 in my version.

Or about an inch below the example I pointed you at.....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ganesh3
PostPosted: Thu Aug 17, 2006 5:05 am    Post subject: RE: Unable to get Message using recieve() Method of JMS Reply with quote

Apprentice

Joined: 30 Mar 2006
Posts: 35

Hi,
The link does not open up correctly. It just shows upa blank page. It seems that link aint correct. Kindly provide the correct link.

Thanks,

Ganesh Bhat
_________________
Have a Good Day!!!
Back to top
View user's profile Send private message Yahoo Messenger
Vitor
PostPosted: Thu Aug 17, 2006 5:14 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

I can't say I'm surprised - that's not a link!

It's a description of where it is in the book (I'm a PDF person). It's in Chapter 10 "Writing Websphere MQ JMS applications" in the section "Sending a message".

I think the online help's organised in the same way...

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Aug 17, 2006 5:17 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

If you open the Websphere MQ thing, there's a list of manuals. Open the Using Java one & a sub-heading is "Tables". One of these (obviously enough) is the Table 13 with the properties in it. Click on that & it seems to take you right there.

(And even in the online version, it's an inch below the example . I've got to get to grips with the info centre....)
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ganesh3
PostPosted: Thu Aug 17, 2006 5:23 am    Post subject: RE: Unable to get Message using recieve() Method of JMS Reply with quote

Apprentice

Joined: 30 Mar 2006
Posts: 35

Hi,
Okie. Got it. Thanks!!!
_________________
Have a Good Day!!!
Back to top
View user's profile Send private message Yahoo Messenger
Vitor
PostPosted: Thu Aug 17, 2006 5:26 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Apologies for any confusion initially caused...

(I remember when books were made of paper.... )
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » IBM MQ Java / JMS » Unable to get Message using recieve() Method of JMS API
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.