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 » How to send message to diff destination of different host

Post new topic  Reply to topic
 How to send message to diff destination of different host « View previous topic :: View next topic » 
Author Message
Neemesh
PostPosted: Mon Dec 12, 2011 1:40 am    Post subject: How to send message to diff destination of different host Reply with quote

Newbie

Joined: 12 Dec 2011
Posts: 5

Hi All,

We are using websphere MQ in our application integrated with spring framework. We use to get the destination from the JMS message replytoqueue property.

We use to configure the host and other by using the application context property.

Till now in our application , the queueManger (Host) used to be same. But as per new requirement, the queueManger(host) will be different.

We are using jmsTemplate.send(queueDestination, new MessageCreator()...
to send the message back to the destination which we are getting from the replytoQueue of message property.

if i use this method now it will fail, as queue will not be present in the host specified by us. Is it any way to resolve this issue.
Back to top
View user's profile Send private message
zpat
PostPosted: Mon Dec 12, 2011 1:53 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

In standard MQI, when you MQOPEN the replytoqueue and replytoqueuemanager, if the queuemanager is not local - then what happens is that the xmit queue to that queue manager is opened instead.

In this way it is possible to open a remote queue for output - even when that queue does not exist on the local queue manager.

I presume JMS can also use this technique?
Back to top
View user's profile Send private message
Neemesh
PostPosted: Mon Dec 12, 2011 2:36 am    Post subject: Reply with quote

Newbie

Joined: 12 Dec 2011
Posts: 5

Thanks Zpat for your reply.

What we has done , we have set default queue manager in the application context and default queue is also there where we have to post the message.
This is when where replytoqueue is not there.

But whenever replyToQueue has some value, then if the queue which is mentioned in replyToQueue is present in that queueManger it will work fine.

But if this queue is not present in that queueManger then it will throw MQ error. ( this all i am talking using JMS and Spring FrameWork).

Do any one of you faced same issue, and how was the solution provided for this....
Back to top
View user's profile Send private message
zpat
PostPosted: Mon Dec 12, 2011 5:26 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

You have to open the queue using the queue manager name you want it to go to, not the local one that does not hold the queue.

MQ cannot read your mind. How do you expect it to know what remote QM you want it to go to, unless you provide the name?
Back to top
View user's profile Send private message
Neemesh
PostPosted: Mon Dec 12, 2011 5:55 am    Post subject: Reply with quote

Newbie

Joined: 12 Dec 2011
Posts: 5

Thanks zpat for your reply.

I have declared the QueueManger details in ApplicationContext and I am generating jmsTemplate based on the request.

But problem is that if a new queue is present in the ReplyToQueue property of the Message, which does not belong to both the queueManager then again it will fail.

So my query was is it possible to send message to destination specified by replyToQueue property of the Message with out adding the queueManager details in our ApplicationContext again and again.
Back to top
View user's profile Send private message
zpat
PostPosted: Mon Dec 12, 2011 6:46 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

I have told you how the MQI works. All you now have to do is work out how (or whether) JMS can map to this.

The QM used for MQCONN does not have to be the same queue manager used for the MQOPEN.

A program can connect to QM A, it can then open an output queue belonging to QM B. This results in MQ putting the message on the xmit queue which does to QM B.

I have deliberately avoided using JMS terminology - you first need to understand the underlying MQI that is being used (and because I don't really know JMS). But a session corresponds to MQOPEN.

Quote:
To create a Queue object, an application can use the MQQueue constructor, as shown in the following example:
MQQueue q1 = new MQQueue("Q1");
This statement creates an MQQueue object with the default values for all its properties. The object represents a WebSphere MQ queue called Q1 that belongs to the local queue manager. This queue can be a local queue, an alias queue, or a remote queue definition.

An alternative form of the MQQueue constructor has two parameters, as shown in the following example:

MQQueue q2 = new MQQueue("QM2", "Q2");

The MQQueue object created by this statement represents a WebSphere MQ queue called Q2 that is owned by queue manager QM2. The queue manager identified in this way can be the local queue manager or a remote queue manager. If it is a remote queue manager, WebSphere MQ must be configured so that, when the application sends a message to this destination, Websphere MQ can route the message from the local queue manager to the remote queue manager. The MQQueue constructor can also accept a queue uniform resource identifier
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Dec 12, 2011 7:12 am    Post subject: Reply with quote

Grand High Poobah

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

Neemesh wrote:
So my query was is it possible to send message to destination specified by replyToQueue property of the Message with out adding the queueManager details in our ApplicationContext again and again.


Accepting that I probably know less about JMS than my worthy associate, isn't it just as simple as creating a JMSQueue object with a Destination URI that includes both the reply to queue manager and queue name? By doing that the name resolution will occur as described in this thread and you're away.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Dec 12, 2011 7:38 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
Neemesh wrote:
So my query was is it possible to send message to destination specified by replyToQueue property of the Message with out adding the queueManager details in our ApplicationContext again and again.


Accepting that I probably know less about JMS than my worthy associate, isn't it just as simple as creating a JMSQueue object with a Destination URI that includes both the reply to queue manager and queue name? By doing that the name resolution will occur as described in this thread and you're away.




EDITED TO ADD:
You don't even necessarily have to specify the Remote queue manager name, if the queue name is resolvable via normal MQ means to point to a remote queue manager.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Dec 12, 2011 7:42 am    Post subject: Reply with quote

Grand High Poobah

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

mqjeff wrote:
Vitor wrote:
Neemesh wrote:
So my query was is it possible to send message to destination specified by replyToQueue property of the Message with out adding the queueManager details in our ApplicationContext again and again.


Accepting that I probably know less about JMS than my worthy associate, isn't it just as simple as creating a JMSQueue object with a Destination URI that includes both the reply to queue manager and queue name? By doing that the name resolution will occur as described in this thread and you're away.




EDITED TO ADD:
You don't even necessarily have to specify the Remote queue manager name, if the queue name is resolvable via normal MQ means to point to a remote queue manager.




I was picturing a scenario where the reply to queue is a temp dynamic on another queue manager which is typically tricky to resolve locally.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Neemesh
PostPosted: Mon Dec 12, 2011 10:59 pm    Post subject: Reply with quote

Newbie

Joined: 12 Dec 2011
Posts: 5

Thanks mqjeff for your reply,

Can you please provide more information or code snippet which will help me doing some code change from my side.

Thanks in advance...
Back to top
View user's profile Send private message
zpat
PostPosted: Mon Dec 12, 2011 11:12 pm    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Do you have trouble reading?

MQQueue q2 = new MQQueue("QM2", "Q2");

Is the way to code it, or use a remote queue definition on the local queue manager.

RTFM. Short of getting on a plane and doing your job for you.....

This forum provides good pointers on how it might be done - the rest is up to you - have you heard of the Infocenter?

You can't expect complete answers - that's like cheating in an exam, and it does not help anyone in the long run.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Dec 13, 2011 6:12 am    Post subject: Reply with quote

Grand High Poobah

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

zpat wrote:
Do you have trouble reading?

Neemesh wrote:
We are using jmsTemplate.send(queueDestination, new MessageCreator()...


I think what Neemesh is looking for is the Destination definition.

Typically you would retrieve your Destination from JNDI and then all is defined there...

However you can also define it programmatically:
Code:
session.createQueue("QUEUENAME");
//or be more specific with
session.createQueue("queue://QMGRNAME/QUEUENAME?attrib1=val1&attribn=valn");


Hope this answers your question
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Neemesh
PostPosted: Wed Dec 14, 2011 3:47 am    Post subject: Reply with quote

Newbie

Joined: 12 Dec 2011
Posts: 5

Thanks zpat & fjb_saper for your info
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » How to send message to diff destination of different host
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.