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 » Howto specify RemoteQmgr/RemoteQ on an MQ message

Post new topic  Reply to topic
 Howto specify RemoteQmgr/RemoteQ on an MQ message « View previous topic :: View next topic » 
Author Message
renrag_ja
PostPosted: Thu Jan 07, 2010 6:01 pm    Post subject: Howto specify RemoteQmgr/RemoteQ on an MQ message Reply with quote

Newbie

Joined: 07 Jan 2010
Posts: 4

Hi Guys,
Whilst I only just registered, this forum has been a great help in the past. I did a search and I can't find exactly what I'm looking for, hence the first post.

I'd really appreciate some input on the following.

Situation:
QManagerA
QManagerB (remote queue manager definition)

QManagerB
QueueOnB (local queue)

Using a tool such as RFHUtil, I can connect to QManagerA via client connection, and specify the destination queue name as QueueOnB. It also lets me enter the queue manager QManagerB in the 'Remote Queue Manager Name (remote queues only)' field. Once I've done this, I write a message and see it arrive on QueueOnB on QManagerB.

My question is, how do I replicate the above functionality using Java code? I.e. I need to specify the destination Queue Manager in the message I'm sending (because it is not a Q local on the queue manager I'm connected to)

Thanks Guys.
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Thu Jan 07, 2010 6:43 pm    Post subject: Re: Howto specify RemoteQmgr/RemoteQ on an MQ message Reply with quote

Grand High Poobah

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

renrag_ja wrote:
My question is, how do I replicate the above functionality using Java code? I.e. I need to specify the destination Queue Manager in the message I'm sending (because it is not a Q local on the queue manager I'm connected to)


By specifying it as the destination? Seriously, it's that easy.

You say you have a "remote queue manager definition" of B on A; if this is what it should be (a transmission queue with the same name as the queue manager it serves) then WMQ will sort it all out even if there's no actual definition on A.

Check out some of the Java samples, and also review name resolution in the Intercommunication manual.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
renrag_ja
PostPosted: Thu Jan 07, 2010 6:45 pm    Post subject: Reply with quote

Newbie

Joined: 07 Jan 2010
Posts: 4

After some more research, it seems that I need to set the ObjectQMgrName field in the MQOD. Can anyone provide some sample code so it is clear at what point during the message publishing this is done?

(btw, I'm using the jars from IBM WebSphere MQ, Version 6.0)
Back to top
View user's profile Send private message Send e-mail
renrag_ja
PostPosted: Thu Jan 07, 2010 6:51 pm    Post subject: Reply with quote

Newbie

Joined: 07 Jan 2010
Posts: 4

Thanks Vitor, you understand what I need to do which is great.

You say to specify it as the destination, but all the sample code I have looked at thus far calls accessQueue() on a qMgr object in order to perform the put (or get).

How would this work otherwise seeing as I can't call accessQueue() on a queue which doesn't exist on the local qMgr? (because it exists on QManagerB)
Back to top
View user's profile Send private message Send e-mail
renrag_ja
PostPosted: Thu Jan 07, 2010 6:59 pm    Post subject: Reply with quote

Newbie

Joined: 07 Jan 2010
Posts: 4

Something like this?
Code:

MQQueueManager qMgr = new MQQueueManager(QManagerA)
...
MQQueue target_queue = qMgr.accessQueue("QueueOnB", openOptions, "QManagerB", null, null);



EDIT: This seems to work from what I've tested so far.
Back to top
View user's profile Send private message Send e-mail
zpat
PostPosted: Fri Jan 08, 2010 12:30 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Coding like this rather imbeds the remote queue information in the application.

It is better to use a remote queue definition on your local queue manager.

The program should ideally be unaware of whether it is putting to a local queue, or remote queue, or alias queue.

(An exception to this might be when replying to a request message and taking the queue manager name from the replytoqueuemanagername field.)
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jan 08, 2010 6:10 am    Post subject: Reply with quote

Grand High Poobah

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

renrag_ja wrote:
How would this work otherwise seeing as I can't call accessQueue() on a queue which doesn't exist on the local qMgr? (because it exists on QManagerB)


I'm the least qualified person round here to answer a Java question, but the accessQueue method takes a queue manager name as a parameter which I'd have thought would be the answer to your question.

I'll defer to more skilled Java people on this.

The comment about either using a queue definition to abstract the destination, or taking the value from an inbound request, is a very good one.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
nathanw
PostPosted: Fri Jan 08, 2010 6:50 am    Post subject: Reply with quote

Knight

Joined: 14 Jul 2004
Posts: 550

zpat wrote:
Coding like this rather imbeds the remote queue information in the application.

It is better to use a remote queue definition on your local queue manager.

The program should ideally be unaware of whether it is putting to a local queue, or remote queue, or alias queue.

(An exception to this might be when replying to a request message and taking the queue manager name from the replytoqueuemanagername field.)




The practice of having your app write to a remote queue all the time would mean that if there were any changes in the future then you would need to make several changes

It would be better to write to a remote queue definition locally and then this can ppoint to wherever you wish it to and any future changes as to destination would be easier to make.
_________________
Who is General Failure and why is he reading my hard drive?

Artificial Intelligence stands no chance against Natural Stupidity.

Only the User Trace Speaks The Truth
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Howto specify RemoteQmgr/RemoteQ on an MQ message
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.